Class: Karasuba

Inherits:
Object
  • Object
show all
Defined in:
lib/karasuba.rb,
lib/karasuba/link.rb,
lib/karasuba/note.rb,
lib/karasuba/todo.rb,
lib/karasuba/parser.rb,
lib/karasuba/version.rb,
lib/karasuba/link_appender.rb,
lib/karasuba/footer_appender.rb

Defined Under Namespace

Classes: FooterAppender, Link, LinkAppender, Note, Parser, Todo

Constant Summary collapse

VERSION =
'0.0.3'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(note_or_string, options = {}) ⇒ Karasuba

Returns a new instance of Karasuba.



18
19
20
21
22
23
24
25
# File 'lib/karasuba.rb', line 18

def initialize(note_or_string, options = {})
  @xml = if note_or_string.respond_to?(:content)
    Nokogiri.parse(note_or_string.content)
  else
    Nokogiri.parse(note_or_string)
  end
  @note = Note.new(xml, options)
end

Instance Attribute Details

#noteObject (readonly)

Returns the value of attribute note.



13
14
15
# File 'lib/karasuba.rb', line 13

def note
  @note
end

#xmlObject (readonly)

Returns the value of attribute xml.



13
14
15
# File 'lib/karasuba.rb', line 13

def xml
  @xml
end

Instance Method Details

#equivalent?(doc_or_string) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/karasuba.rb', line 27

def equivalent?(doc_or_string)
  note.equivalent?(doc_or_string)
end

#todosObject



31
32
33
# File 'lib/karasuba.rb', line 31

def todos
  note.todos
end