Class: WWW::Delicious::Bundle
Overview
Delicious Bundle
Represents a single Bundle element.
Instance Attribute Summary (collapse)
-
- (Object) name
Returns value for name attribute.
-
- (Object) tags
The collection of WWW::Delicious::Tags.
Class Method Summary (collapse)
-
+ (Object) from_rexml(element)
Creates and returns new instance from a REXML element.
Instance Method Summary (collapse)
-
- (Object) to_s
Returns a string representation of this Bundle.
Methods inherited from Element
Constructor Details
This class inherits a constructor from WWW::Delicious::Element
Instance Attribute Details
- (Object) name
Returns value for name attribute. Value is always normalized as lower string.
31 32 33 |
# File 'lib/www/delicious/bundle.rb', line 31 def name @name.to_s.strip unless @name.nil? end |
- (Object) tags
The collection of WWW::Delicious::Tags.
34 35 36 |
# File 'lib/www/delicious/bundle.rb', line 34 def @tags end |
Class Method Details
+ (Object) from_rexml(element)
Creates and returns new instance from a REXML element.
Implements Element#from_rexml.
59 60 61 62 63 64 65 66 |
# File 'lib/www/delicious/bundle.rb', line 59 def from_rexml(element) raise ArgumentError, "`element` expected to be a `REXML::Element`" unless element.kind_of? REXML::Element self.new do |instance| instance.name = element.if_attribute_value(:name) # FIXME: value must be converted to array of Tag instance. = element.if_attribute_value(:tags) { |value| value.split(' ') } end end |
Instance Method Details
- (Object) to_s
Returns a string representation of this Bundle. In case name is nil this method will return an empty string.
47 48 49 |
# File 'lib/www/delicious/bundle.rb', line 47 def to_s name.to_s end |