Class: WWW::Delicious::Bundle
- Inherits:
-
Object
- Object
- WWW::Delicious::Bundle
- Defined in:
- lib/www/delicious/bundle.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
The name of the bundle.
-
#tags ⇒ Object
The collection of
WWW::Delicious::Tags
.
Class Method Summary collapse
-
.from_rexml(element) ⇒ Object
Creates a new
WWW::Delicious::Bundle
from a REXML fragment.
Instance Method Summary collapse
-
#initialize(name, tags = []) {|_self| ... } ⇒ Bundle
constructor
Creates a new
WWW::Delicious::Bundle
with givenname
and adds given array oftags
to current tags collection.
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.
33 34 35 36 37 38 39 40 |
# File 'lib/www/delicious/bundle.rb', line 33 def initialize(name, = [], &block) # :yields: bundle raise ArgumentError, '`tags` expected to be an Array' unless .kind_of?(Array) self.name = name.to_s() self. = yield(self) if block_given? self end |
Instance Attribute Details
#name ⇒ Object
The name of the bundle
23 24 25 |
# File 'lib/www/delicious/bundle.rb', line 23 def name @name end |
#tags ⇒ Object
The collection of WWW::Delicious::Tags
26 27 28 |
# File 'lib/www/delicious/bundle.rb', line 26 def @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 |