Sha256: 346c6809267ebe6e91f9c08c90b35019a14ee72ccae598d565b54601eb584f32
Contents?: true
Size: 620 Bytes
Versions: 3
Compression:
Stored size: 620 Bytes
Contents
module Radiustar class ValuesCollection < Array def initialize @collection = {} @revcollection = {} end def add(name, id) @collection[name] ||= Value.new(name, id) @revcollection[id.to_i] ||= @collection[name] self << @collection[name] end def find_by_name(name) @collection[name] end def find_by_id(id) @revcollection[id] end def empty? @collection.empty? end end class Value include Radiustar attr_accessor :name, :id def initialize(name, id) @name = name @id = id.to_i end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dguerri-radiustar-0.1.0 | lib/radiustar/dictionary/values.rb |
dguerri-radiustar-0.0.5 | lib/radiustar/dictionary/values.rb |
dguerri-radiustar-0.0.4 | lib/radiustar/dictionary/values.rb |