Sha256: d25b4b444c43ab4a82e95941701fd0b9cb6823259d62295709bb034d558128a6
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
module HentryConsumer class HEntry < Element attr_accessor :name, :categories, :author, :content, :bookmark, :published_at, :summary alias_method :authors, :author def parse_p_name(element) assign_value :name, element.text end def parse_p_author(element) assign_value :author, HCard.new(element.children) end def parse_p_category(element) self.categories ||= {} self.categories[element.text.gsub("\n", " ").strip] = element["href"] end def parse_e_content(element) assign_value :content, element.inner_html end def parse_dt_published(element) assign_value :published_at, element["datetime"] end def parse_u_uid(element) assign_value :bookmark, element["href"] end def parse_p_summary(element) assign_value :summary, element.text end def to_hash { :type => ["h-entry"], :properties => { :name => self.name, :categories => self.categories, :author => self.author, :content => self.content, :bookmark => self.bookmark, :published_at => self.published_at, :summary => self.summary } } end def to_json(*a) to_hash.to_json(a) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hentry_consumer-0.5.2 | lib/hentry_consumer/h_entry.rb |