Module: Cropio::Resource::Attributes

Included in:
Base
Defined in:
lib/cropio/resource/attributes.rb

Class Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *attrs, &block) ⇒ Object (protected)



62
63
64
65
66
67
68
69
70
71
# File 'lib/cropio/resource/attributes.rb', line 62

def method_missing(name, *attrs, &block)
  name = name.to_s
  attr_name = name.gsub('=', '')
  if attributes.has_key?(attr_name)
    define_attributes_accessors
    name == attr_name ? send(name) : send(name, attrs.first)
  else
    super
  end
end

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/cropio/resource/attributes.rb', line 4

def self.included(base)
  base.send(:attr_accessor, :attributes)
end