Class: Gom::Remote::Entry

Inherits:
Object
  • Object
show all
Includes:
Gom::Remote
Defined in:
lib/gom/remote/entry.rb

Instance Method Summary collapse

Instance Method Details

#connectionObject

@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

#gomObject



5
6
7
# File 'lib/gom/remote/entry.rb', line 5

def gom 
  Gom::Remote.connection
end