Sha256: e2aa8bd96b004becc9c3a49f35ee7ebc5cdb18a58cd1fa396a89bfbe4919d177

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 Bytes

Contents

# The representation of the base unit in boom. An Item contains just a name and
# a value. It doesn't know its parent relationship explicitly; the parent List
# object instead knows which Items it contains.
#
module Boom
  class Item
    
    # Public: the String name of the Item
    attr_accessor :name

    # Public: the String value of the Item
    attr_accessor :value

    # Public: creates a new Item object.
    #
    # name  - the String name of the Item
    # value - the String value of the Item
    #
    # Examples
    #
    #   Item.new("github", "http://github.com")
    #
    # Returns the newly initialized Item.
    def initialize(name,value)
      @name = name
      @value = value
    end

    # Public: creates a Hash for this Item.
    #
    # Returns a Hash of its data.
    def to_hash
      { @name => @value }
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boom-0.0.5 lib/boom/item.rb
boom-0.0.4 lib/boom/item.rb
boom-0.0.3 lib/boom/item.rb
boom-0.0.2 lib/boom/item.rb
boom-0.0.1 lib/boom/item.rb