Class: Stardog::LinkedJSON

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ LinkedJSON

Returns a new instance of LinkedJSON.



57
58
59
# File 'lib/stardog.rb', line 57

def initialize(attributes = {})
  @attributes = attributes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



85
86
87
# File 'lib/stardog.rb', line 85

def method_missing(meth, *args, &block)
  @attributes.send(meth, *args, &block) if @attributes.respond_to?(meth)
end

Instance Method Details

#[](arg) ⇒ Object



69
70
71
# File 'lib/stardog.rb', line 69

def [](arg) 
  @attributes[arg]
end

#[]=(arg, value) ⇒ Object



73
74
75
# File 'lib/stardog.rb', line 73

def []=(arg,value)
  @attributes[arg] = value
end

#get(key) ⇒ Object



61
62
63
# File 'lib/stardog.rb', line 61

def get(key)
  @attributes[key]
end

#raw_jsonObject



77
78
79
# File 'lib/stardog.rb', line 77

def raw_json
  @attributes
end

#set(key, value) ⇒ Object



65
66
67
# File 'lib/stardog.rb', line 65

def set(key,value)
  @attributes[key] = value
end

#to_sObject



81
82
83
# File 'lib/stardog.rb', line 81

def to_s
  @attributes.to_json
end