Class: RPCMapper::Base
- Inherits:
-
Object
- Object
- RPCMapper::Base
- Defined in:
- lib/rpc_mapper/base.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#new_record ⇒ Object
(also: #new_record?)
Returns the value of attribute new_record.
-
#read_options ⇒ Object
Returns the value of attribute read_options.
-
#write_options ⇒ Object
Returns the value of attribute write_options.
Class Method Summary collapse
- .inherited(subclass) ⇒ Object
- .new_from_data_store(hash) ⇒ Object
- .respond_to?(method, include_private = false) ⇒ Boolean
- .unscoped ⇒ Object
Instance Method Summary collapse
- #[](attribute) ⇒ Object
-
#initialize(attributes = {}) ⇒ Base
constructor
A new instance of Base.
Methods included from Scopes
Methods included from Serialization
Methods included from AssociationPreload
Methods included from Associations::External
Methods included from Associations::Contains
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
29 30 31 32 |
# File 'lib/rpc_mapper/base.rb', line 29 def initialize(attributes={}) self.new_record = true set_attributes(attributes) end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
20 21 22 |
# File 'lib/rpc_mapper/base.rb', line 20 def attributes @attributes end |
#new_record ⇒ Object Also known as: new_record?
Returns the value of attribute new_record.
20 21 22 |
# File 'lib/rpc_mapper/base.rb', line 20 def new_record @new_record end |
#read_options ⇒ Object
Returns the value of attribute read_options.
20 21 22 |
# File 'lib/rpc_mapper/base.rb', line 20 def @read_options end |
#write_options ⇒ Object
Returns the value of attribute write_options.
20 21 22 |
# File 'lib/rpc_mapper/base.rb', line 20 def @write_options end |
Class Method Details
.inherited(subclass) ⇒ Object
81 82 83 84 |
# File 'lib/rpc_mapper/base.rb', line 81 def inherited(subclass) update_extension_map(self, subclass) super end |
.new_from_data_store(hash) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/rpc_mapper/base.rb', line 61 def new_from_data_store(hash) if hash.nil? nil else record = self.new(hash) record.new_record = false record end end |
.respond_to?(method, include_private = false) ⇒ Boolean
86 87 88 89 |
# File 'lib/rpc_mapper/base.rb', line 86 def respond_to?(method, include_private=false) super || scoped.dynamic_finder_method(method) end |
.unscoped ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/rpc_mapper/base.rb', line 71 def unscoped current_scopes = self.scoped_methods self.scoped_methods = [] begin yield ensure self.scoped_methods = current_scopes end end |
Instance Method Details
#[](attribute) ⇒ Object
34 35 36 |
# File 'lib/rpc_mapper/base.rb', line 34 def [](attribute) @attributes[attribute.to_s] end |