Sha256: 5a506804257fbbd7f8000931ff53d5b023ee88f9c3bebbd7e40a44376c1be625
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
module Nokogiri::Decorators::XBEL autoload :Folder, "#{ File.dirname __FILE__ }/xbel/folder.rb" autoload :Seperator, "#{ File.dirname __FILE__ }/xbel/folder.rb" autoload :Bookmark, "#{ File.dirname __FILE__ }/xbel/bookmark.rb" autoload :Alias, "#{ File.dirname __FILE__ }/xbel/alias.rb" def self.extended(base) case base.name when 'title' when 'desc' when 'bookmark' base.extend Bookmark when 'folder' base.extend Folder when 'separator' base.extend Separator when 'alias' base.extend Alias when 'xbel' base.extend Folder end end module Entry def desc if node = at('./desc') then node.content end end def desc=(value) node = at './desc' node ||= add_child Nokogiri::XML::Node.new('desc', document) node.content = value end alias_method :description, :desc alias_method :description=, :desc= def title if node = at('./title') then node.content end end def title=(value) node = at './title' node ||= add_child Nokogiri::XML::Node.new('title', document) node.content = value end alias_method :to_s, :title def id if id = attribute('id') then id.content end end def id=(value) set_attribute 'id', value.to_s end def added if value = attribute('added') then Date.parse value.content end end def added=(value) set_attribute 'added', value.to_s end def alias?; end def bookmark?; end def folder?; end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xbel-0.2.0 | lib/nokogiri/decorators/xbel.rb |
xbel-0.1.2 | lib/nokogiri/decorators/xbel.rb |
xbel-0.1.1 | lib/nokogiri/decorators/xbel.rb |