Class: Wutang::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/wutang/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/wutang/entry.rb', line 3

def attributes
  @attributes
end

#pathObject (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_jsonObject



18
19
20
# File 'lib/wutang/entry.rb', line 18

def as_json
  attributes
end

#to_sObject



22
23
24
# File 'lib/wutang/entry.rb', line 22

def to_s
  attributes.merge(id: path).to_s
end