Class: Localwiki::Resource

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/localwiki/resource.rb

Overview

simple OpenStruct object to allow attribute access on resources (instead of hash key access)

Direct Known Subclasses

File, Map, Page, PageTags, Site, Tag, User

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_hash) ⇒ Resource

create instance of resource

Parameters:

  • json_hash (Hash)

    hash object from parsed json



25
26
27
28
# File 'lib/localwiki/resource.rb', line 25

def initialize json_hash
  @json = json_hash
  super
end

Instance Attribute Details

#jsonObject (readonly)

raw json string used to instanciate object



20
21
22
# File 'lib/localwiki/resource.rb', line 20

def json
  @json
end