Sha256: 72235f0102af482c6e135fdd059caefb3f899f054816dc92ba6c490b57b9ab8b

Contents?: true

Size: 926 Bytes

Versions: 5

Compression:

Stored size: 926 Bytes

Contents

module Gom
  module Remote
    class Entry
      include Gom::Remote
      def gom 
        Gom::Remote.connection
      end
      # @deprecated?
      def connection 
        Gom::Remote.connection
      end

=begin
      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
=end

      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gom-script-0.2.2 lib/gom/remote/entry.rb
gom-script-0.2.0 lib/gom/remote/entry.rb
gom-script-0.1.6 lib/gom/remote/entry.rb
gom-script-0.1.5 lib/gom/remote/entry.rb
gom-script-0.1.4 lib/gom/remote/entry.rb