Files

Axiom::Types::Options

A module that adds class and instance level options

Public Instance Methods

accept_options(*new_options) click to toggle source

Defines which options are valid for a given attribute class

@example

class MyTypes < Axiom::Types::Object
  accept_options :foo, :bar
end

@return [self]

@api public

# File lib/axiom/types/support/options.rb, line 21
def accept_options(*new_options)
  (new_options - accepted_options).each do |new_option|
    assert_method_available(new_option)
    define_option_method(new_option)
    setup_option(new_option)
  end
  self
end

Protected Instance Methods

setup_option(new_option) click to toggle source

Set up the option in the current class and descendants

@param [Symbol] new_option

new option to be added

@return [self]

@api private

# File lib/axiom/types/support/options.rb, line 40
def setup_option(new_option)
  instance_variable_set(:"@#{new_option}", nil)
  accepted_options << new_option
  descendants.each do |descendant|
    descendant.send(__method__, new_option)
  end
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.