Class: Gom::Remote::Entry
- Inherits:
-
Object
- Object
- Gom::Remote::Entry
- Includes:
- Gom::Remote
- Defined in:
- lib/gom/remote/entry.rb
Instance Method Summary collapse
-
#connection ⇒ Object
@deprecated?.
-
#gnode(path) ⇒ Object
def initialize @path = nil @attributes = {} @children = {} end.
- #gom ⇒ Object
Instance Method Details
#connection ⇒ Object
@deprecated?
9 10 11 |
# File 'lib/gom/remote/entry.rb', line 9 def connection Gom::Remote.connection end |
#gnode(path) ⇒ Object
def initialize
@path = nil
@attributes = {}
@children = {}
end
def new_record?
@path.nil?
end
def create path
@path.nil || raise ""
end
def save
end
def attributes
@attributes
end
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gom/remote/entry.rb', line 36 def gnode path json = (connection.read "#{path}.json") (JSON.parse json)["node"]["entries"].select do |entry| # 1. select attribute entries entry.has_key? "attribute" end.inject({}) do |h, a| # 2. make it a key, value list h[a["attribute"]["name"].to_sym] = a["attribute"]["value"] h end end |
#gom ⇒ Object
5 6 7 |
# File 'lib/gom/remote/entry.rb', line 5 def gom Gom::Remote.connection end |