Class: Sjp::Parser
- Inherits:
-
Object
- Object
- Sjp::Parser
- Defined in:
- lib/sjp/parser.rb
Overview
Parser class
Instance Attribute Summary collapse
-
#html ⇒ Object
Returns the value of attribute html.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#word ⇒ Object
Returns the value of attribute word.
Instance Method Summary collapse
- #allowed? ⇒ Boolean
- #description ⇒ Object
- #exist? ⇒ Boolean
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
- #variety? ⇒ Boolean
Constructor Details
#initialize ⇒ Parser
Returns a new instance of Parser.
11 12 13 |
# File 'lib/sjp/parser.rb', line 11 def initialize @word, @html, @page, @hash = '', '', nil, {} end |
Instance Attribute Details
#html ⇒ Object
Returns the value of attribute html.
9 10 11 |
# File 'lib/sjp/parser.rb', line 9 def html @html end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
9 10 11 |
# File 'lib/sjp/parser.rb', line 9 def page @page end |
#word ⇒ Object
Returns the value of attribute word.
9 10 11 |
# File 'lib/sjp/parser.rb', line 9 def word @word end |
Instance Method Details
#allowed? ⇒ Boolean
29 30 31 32 33 |
# File 'lib/sjp/parser.rb', line 29 def allowed? # TODO: tests for exist and allow # exist? && (status != 'niedopuszczalne w grach') status == 'dopuszczalne w grach ' end |
#description ⇒ Object
39 40 41 |
# File 'lib/sjp/parser.rb', line 39 def description @page.css('p')[3].text end |
#exist? ⇒ Boolean
22 23 24 25 26 27 |
# File 'lib/sjp/parser.rb', line 22 def exist? ![ 'słowo występuje tylko jako część innych haseł', 'nie występuje w słowniku' ].include? status end |
#variety? ⇒ Boolean
35 36 37 |
# File 'lib/sjp/parser.rb', line 35 def variety? @hash['odmienność:'] == 'tak' end |