Module: Flatter::Mapper::AttributeMethods

Included in:
Flatter::Mapper
Defined in:
lib/flatter/mapper/attribute_methods.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/flatter/mapper/attribute_methods.rb', line 7

def method_missing(name, *args, &block)
  return super if @_attribute_methods_defined

  extend attribute_methods
  @_attribute_methods_defined = true

  send(name, *args, &block)
end

Instance Method Details

#respond_to_missing?(name) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/flatter/mapper/attribute_methods.rb', line 3

def respond_to_missing?(name, *)
  mapping_names.map{ |name| [name, :"#{name}="] }.flatten.include?(name) || super
end