Class: Struct

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

Overview

at_xpath is to return single element and you know only there is only one element. xpath is to return an array of elements

Direct Known Subclasses

Doubapi::Album, Doubapi::Event, Doubapi::Track

Instance Method Summary collapse

Instance Method Details

#jsonObject



51
52
53
# File 'lib/doubapi.rb', line 51

def json
    JSON.pretty_generate(self)
end

#to_json(*a) ⇒ Object



47
48
49
# File 'lib/doubapi.rb', line 47

def to_json(*a)
    to_map.to_json(*a)
end

#to_mapObject



41
42
43
44
45
# File 'lib/doubapi.rb', line 41

def to_map
    map = Hash.new
    self.members.each { |m| map[m] = self[m] }
    map
end