Class: Wutang::Entry
- Inherits:
-
Object
- Object
- Wutang::Entry
- Defined in:
- lib/wutang/entry.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #as_json ⇒ Object
-
#initialize(attributes, path) ⇒ Entry
constructor
A new instance of Entry.
- #to_s ⇒ Object
Constructor Details
#initialize(attributes, path) ⇒ Entry
Returns a new instance of Entry.
5 6 7 8 |
# File 'lib/wutang/entry.rb', line 5 def initialize(attributes, path) @attributes = attributes @path = path end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/wutang/entry.rb', line 3 def attributes @attributes end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/wutang/entry.rb', line 3 def path @path end |
Instance Method Details
#[](key) ⇒ Object
10 11 12 |
# File 'lib/wutang/entry.rb', line 10 def [](key) attributes[key] end |
#[]=(key, value) ⇒ Object
14 15 16 |
# File 'lib/wutang/entry.rb', line 14 def []=(key, value) attributes[key] = value end |
#as_json ⇒ Object
18 19 20 |
# File 'lib/wutang/entry.rb', line 18 def as_json attributes end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/wutang/entry.rb', line 22 def to_s attributes.merge(id: path).to_s end |