class RSS::Atom::Entry

定义顶级的 Atom Entry 元素,用作独立的 Atom Entry 文档的文档元素。它具有以下属性:

  • author

  • category

  • categories

  • content

  • contributor

  • id

  • link

  • published

  • rights

  • source

  • summary

  • title

  • updated

参考: validator.w3.org/feed/docs/rfc4287.html#element.entry]

常量

Author

Feed::Entry::Author

Category

Feed::Entry::Category

Content

Feed::Entry::Content

Contributor

Feed::Entry::Contributor

Id

Feed::Entry::Id

Feed::Entry::Link

Published

Feed::Entry::Published

Rights

Feed::Entry::Rights

Source

Feed::Entry::Source

Summary

Feed::Entry::Summary

Title

Feed::Entry::Title

Updated

Feed::Entry::Updated

公共类方法

new(version=nil, encoding=nil, standalone=nil) 点击切换源码

创建一个新的 Atom Entry 元素。

调用父类方法 RSS::RootElementMixin::new
# File rss-0.3.1/lib/rss/atom.rb, line 922
def initialize(version=nil, encoding=nil, standalone=nil)
  super("1.0", version, encoding, standalone)
  @feed_type = "atom"
  @feed_subtype = "entry"
end

公共实例方法

have_author?() 点击切换源码

返回是否存在任何作者,或者是否存在具有作者的源。

# File rss-0.3.1/lib/rss/atom.rb, line 941
def have_author?
  authors.any? {|author| !author.to_s.empty?} or
    (source and source.have_author?)
end
items() 点击切换源码

以数组形式返回 Entry

# File rss-0.3.1/lib/rss/atom.rb, line 929
def items
  [self]
end
setup_maker(maker) 点击切换源码

设置 maker 以构造 Entry 元素。

# File rss-0.3.1/lib/rss/atom.rb, line 934
def setup_maker(maker)
  maker = maker.maker if maker.respond_to?("maker")
  super(maker)
end

私有实例方法

atom_validate(ignore_unknown_element, tags, uri) 点击切换源码
# File rss-0.3.1/lib/rss/atom.rb, line 947
def atom_validate(ignore_unknown_element, tags, uri)
  unless have_author?
    raise MissingTagError.new("author", tag_name)
  end
  validate_duplicate_links(links)
end
have_required_elements?() 点击切换源码
# File rss-0.3.1/lib/rss/atom.rb, line 954
def have_required_elements?
  super and have_author?
end
maker_target(maker) 点击切换源码
# File rss-0.3.1/lib/rss/atom.rb, line 958
def maker_target(maker)
  maker.items.new_item
end