Class: Everybit::EverybitObject
- Inherits:
-
Object
- Object
- Everybit::EverybitObject
- Defined in:
- lib/everybit/everybit_object.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #[](k) ⇒ Object
- #[]=(k, v) ⇒ Object
-
#initialize(code, status, data) ⇒ EverybitObject
constructor
A new instance of EverybitObject.
- #inspect ⇒ Object
- #to_json(*a) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(code, status, data) ⇒ EverybitObject
Returns a new instance of EverybitObject.
6 7 8 9 10 |
# File 'lib/everybit/everybit_object.rb', line 6 def initialize(code, status, data) @code = code @status = status @data = data end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/everybit/everybit_object.rb', line 4 def code @code end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/everybit/everybit_object.rb', line 4 def status @status end |
Instance Method Details
#[](k) ⇒ Object
12 13 14 |
# File 'lib/everybit/everybit_object.rb', line 12 def [](k) @data[k] end |
#[]=(k, v) ⇒ Object
16 17 18 |
# File 'lib/everybit/everybit_object.rb', line 16 def []=(k, v) @data[k] = v end |
#inspect ⇒ Object
28 29 30 |
# File 'lib/everybit/everybit_object.rb', line 28 def inspect() "#<#{self.class}:#{@data[:uuid]}> JSON: #{@data}" end |
#to_json(*a) ⇒ Object
24 25 26 |
# File 'lib/everybit/everybit_object.rb', line 24 def to_json(*a) @data end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/everybit/everybit_object.rb', line 20 def to_s MultiJson.dump(@data) end |