Module: RHC::Rest::Attributes
- Included in:
- Base
- Defined in:
- lib/rhc/rest/attributes.rb
Instance Method Summary collapse
- #attribute(name) ⇒ Object
- #attributes ⇒ Object
- #attributes=(attr = nil) ⇒ Object
- #clear_attribute(name) ⇒ Object
Instance Method Details
#attribute(name) ⇒ Object
10 11 12 |
# File 'lib/rhc/rest/attributes.rb', line 10 def attribute(name) instance_variable_get("@#{name}") || attributes[name.to_s] end |
#attributes ⇒ Object
2 3 4 |
# File 'lib/rhc/rest/attributes.rb', line 2 def attributes @attributes end |
#attributes=(attr = nil) ⇒ Object
6 7 8 |
# File 'lib/rhc/rest/attributes.rb', line 6 def attributes=(attr=nil) @attributes = (attr || {}).stringify_keys! end |
#clear_attribute(name) ⇒ Object
14 15 16 17 |
# File 'lib/rhc/rest/attributes.rb', line 14 def clear_attribute(name) v = instance_variable_set("@#{name}", nil) attributes.delete(name.to_s) or v end |