Module: Cropio::Resource::Attributes

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

Overview

Defines accessors for resource attrubutes.

Class Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



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

def method_missing(name, *attrs, &block)
  name = name.to_s
  attr_name = name.delete('=')
  if attributes.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



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

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