Module: RHC::Rest::Attributes

Included in:
Base
Defined in:
lib/rhc/rest/attributes.rb

Instance Method Summary collapse

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

#attributesObject



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