Class: WWW::Delicious::Bundle

Inherits:
Object
  • Object
show all
Defined in:
lib/www/delicious/bundle.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, tags = []) {|_self| ... } ⇒ Bundle

Creates a new WWW::Delicious::Bundle with given name and adds given array of tags to current tags collection.

Yields:

  • (_self)

Yield Parameters:

Raises:

  • (ArgumentError)


33
34
35
36
37
38
39
40
# File 'lib/www/delicious/bundle.rb', line 33

def initialize(name, tags = [], &block) #  :yields: bundle
  raise ArgumentError, '`tags` expected to be an Array' unless tags.kind_of?(Array)
  
  self.name = name.to_s()
  self.tags = tags
  yield(self) if block_given?
  self
end

Instance Attribute Details

#nameObject

The name of the bundle



23
24
25
# File 'lib/www/delicious/bundle.rb', line 23

def name
  @name
end

#tagsObject

The collection of WWW::Delicious::Tags



26
27
28
# File 'lib/www/delicious/bundle.rb', line 26

def tags
  @tags
end

Class Method Details

.from_rexml(element) ⇒ Object

Creates a new WWW::Delicious::Bundle from a REXML fragment.



46
47
48
49
# File 'lib/www/delicious/bundle.rb', line 46

def self.from_rexml(element)
  return new(element.attribute_value(:name) { |v| v.to_s() },
             element.attribute_value(:tags) { |v| v.to_s().split(' ') })
end