Class: WWW::Delicious::Bundle

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

Overview

Delicious Bundle

Represents a single Bundle element.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Element

#initialize

Constructor Details

This class inherits a constructor from WWW::Delicious::Element

Instance Attribute Details

#nameObject

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
end

#tagsObject

The collection of WWW::Delicious::Tags.



34
35
36
# File 'lib/www/delicious/bundle.rb', line 34

def tags
  @tags
end

Class Method Details

.from_rexml(element) ⇒ Object

Creates and returns new instance from a REXML element.

Implements Element#from_rexml.

Raises:

  • (ArgumentError)


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.tags  = element.if_attribute_value(:tags) { |value| value.split(' ') }
  end
end

Instance Method Details

#to_sObject

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