Class: PropertyList

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

Instance Method Summary collapse

Constructor Details

#initializePropertyList

Returns a new instance of PropertyList.



59
60
61
62
# File 'lib/common/properties.rb', line 59

def initialize
  @keys = Array.new
  @values = Array.new
end

Instance Method Details

#get(key) ⇒ Object



75
76
77
78
79
80
81
82
# File 'lib/common/properties.rb', line 75

def get( key )
  i = @keys.index( key )
  if ( i == nil )
    return nil
  end
  
  return @values[i]
end

#keysObject

Keeps the order where key-value pairs were inserted



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

def keys
  return @keys
end

#put(key, value) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/common/properties.rb', line 65

def put( key, value )
  if ( get( key ) != nil )
    raise 'Key is already used'
  end
  
  @keys.push( key )
  @values.push( value )
end