Class: Karasuba::Note
- Inherits:
-
Object
- Object
- Karasuba::Note
- Defined in:
- lib/karasuba/note.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#todos ⇒ Object
readonly
Returns the value of attribute todos.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
- #append_footer(text, options = {}) ⇒ Object
- #equivalent?(doc_or_string) ⇒ Boolean
- #footer?(title) ⇒ Boolean
-
#initialize(xml, options = {}) ⇒ Note
constructor
A new instance of Note.
Constructor Details
#initialize(xml, options = {}) ⇒ Note
Returns a new instance of Note.
5 6 7 8 9 10 11 |
# File 'lib/karasuba/note.rb', line 5 def initialize(xml, = {}) @xml = xml = @todos = [] @todo_elements = xml.xpath('//en-todo') instanciate_todos end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/karasuba/note.rb', line 3 def end |
#todos ⇒ Object (readonly)
Returns the value of attribute todos.
3 4 5 |
# File 'lib/karasuba/note.rb', line 3 def todos @todos end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
3 4 5 |
# File 'lib/karasuba/note.rb', line 3 def xml @xml end |
Instance Method Details
#append_footer(text, options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/karasuba/note.rb', line 13 def (text, = {}) appender = .new() appender.(text, ) end |
#equivalent?(doc_or_string) ⇒ Boolean
18 19 20 21 |
# File 'lib/karasuba/note.rb', line 18 def equivalent?(doc_or_string) doc_or_string = Nokogiri.parse(doc_or_string) if doc_or_string.is_a?(String) EquivalentXml.equivalent?(self.xml, doc_or_string, element_order: true, normalize_whitespace: true) end |
#footer?(title) ⇒ Boolean
23 24 25 |
# File 'lib/karasuba/note.rb', line 23 def (title) !!self.xml.xpath("//*[attribute::title=\"#{title}\"]").last end |