Class: RIPE::AttributeSet

Inherits:
Array
  • Object
show all
Defined in:
lib/ripe/attribute_set.rb

Instance Method Summary collapse

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

#nameObject



10
11
12
# File 'lib/ripe/attribute_set.rb', line 10

def name
  @name
end

#to_api_hashObject



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