Class: Textract::Client
- Inherits:
-
Object
- Object
- Textract::Client
- Defined in:
- lib/textract.rb
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url, selectors) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(url, selectors) ⇒ Client
Returns a new instance of Client.
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/textract.rb', line 67 def initialize(url, selectors) @url = url @html = HTTParty.get url = Textract.(@html) if .nil? or .description.nil? # use readability method @text = Textract.get_text_from_description(@html, nil, selectors) @title = Textract.get_page_title(@html) else @text = Textract.get_text_from_description(@html, .description, selectors) @title = .title end end |
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
61 62 63 |
# File 'lib/textract.rb', line 61 def html @html end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
63 64 65 |
# File 'lib/textract.rb', line 63 def end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
65 66 67 |
# File 'lib/textract.rb', line 65 def text @text end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
64 65 66 |
# File 'lib/textract.rb', line 64 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
62 63 64 |
# File 'lib/textract.rb', line 62 def url @url end |