Class: Array

Inherits:
Object
  • Object
show all
Includes:
Arcade::Support::Array, Arcade::Support::Model
Defined in:
lib/support/conversions.rb

Constant Summary collapse

@@accepted_methods =
[:"_allocate_model"]

Instance Method Summary collapse

Methods included from Arcade::Support::Model

#_allocate_model, #resolve_edge_name

Methods included from Arcade::Support::Array

#allocate_model, #analyse, #arcade_flatten, #from_db, #select_result, #to_db, #to_html, #to_human, #to_or

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &b) ⇒ Object

it is assumed that the first element of the array acts as master .



94
95
96
97
98
99
100
101
# File 'lib/support/conversions.rb', line 94

def method_missing method, *args, &b
	return if [:to_hash, :to_str].include? method
   if @@accepted_methods.include?( method ) || first.invariant_attributes.include?( method )
     self.map{ |x| x.public_send method, *args, &b }
   else
     raise ArgumentError.new("Method #{method} does not exist in class #{first.class}")
   end
end