Class: RIPE::AttributeSet
- Inherits:
-
Array
- Object
- Array
- RIPE::AttributeSet
- Defined in:
- lib/ripe/attribute_set.rb
Instance Method Summary collapse
- #add(value) ⇒ Object
-
#initialize(client, name) ⇒ AttributeSet
constructor
A new instance of AttributeSet.
- #name ⇒ Object
- #to_api_hash ⇒ Object
- #update(values) ⇒ Object
Constructor Details
#initialize(client, name) ⇒ AttributeSet
Returns a new instance of AttributeSet.
4 5 6 7 8 |
# File 'lib/ripe/attribute_set.rb', line 4 def initialize(client, name) @client = client @name = name super([]) end |
Instance Method Details
#add(value) ⇒ Object
14 15 16 |
# File 'lib/ripe/attribute_set.rb', line 14 def add(value) self << Attribute.new(@client, 'name' => @name, 'value' => value) end |
#name ⇒ Object
10 11 12 |
# File 'lib/ripe/attribute_set.rb', line 10 def name @name end |
#to_api_hash ⇒ Object
24 25 26 |
# File 'lib/ripe/attribute_set.rb', line 24 def to_api_hash map(&:to_api_hash) end |
#update(values) ⇒ Object
18 19 20 21 22 |
# File 'lib/ripe/attribute_set.rb', line 18 def update(values) clear values = [values] unless values.is_a?(Array) values.each { |value| add(value) } end |