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



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

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

#mounting(name) ⇒ Object



17
18
19
# File 'lib/flatter/mapper/attribute_methods.rb', line 17

def mounting(name)
  find_mounting(name.to_s)
end

#respond_to_missing?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

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