Class: Nwiki::Core::Page
- Inherits:
-
Object
- Object
- Nwiki::Core::Page
- Defined in:
- lib/nwiki/core/page.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #encoding ⇒ Object
-
#initialize(title, doc, parser_class) ⇒ Page
constructor
A new instance of Page.
- #to_html ⇒ Object
Constructor Details
#initialize(title, doc, parser_class) ⇒ Page
Returns a new instance of Page.
6 7 8 9 10 11 |
# File 'lib/nwiki/core/page.rb', line 6 def initialize title, doc, parser_class raise 'title is empty or nil' unless title raise 'doc is empty or nil' unless doc raise 'parser_class is empty or nil' unless parser_class @title, @doc, @parser_class = title, doc, parser_class end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
4 5 6 |
# File 'lib/nwiki/core/page.rb', line 4 def doc @doc end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/nwiki/core/page.rb', line 4 def title @title end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 24 25 |
# File 'lib/nwiki/core/page.rb', line 21 def == other return false unless other self.kind_of?(other.class) && self.doc == other.doc end |
#encoding ⇒ Object
13 14 15 |
# File 'lib/nwiki/core/page.rb', line 13 def encoding @doc.encoding end |
#to_html ⇒ Object
17 18 19 |
# File 'lib/nwiki/core/page.rb', line 17 def to_html @parser_class.new(@doc, offset: 1).to_html end |