Class: Iqdb::Client::Parser::Alt
- Inherits:
-
Object
- Object
- Iqdb::Client::Parser::Alt
- Defined in:
- lib/iqdb/client/parser/alt.rb
Instance Attribute Summary collapse
-
#str ⇒ Object
readonly
Returns the value of attribute str.
Instance Method Summary collapse
-
#initialize(str) ⇒ Alt
constructor
A new instance of Alt.
- #rating ⇒ Object
- #tags ⇒ Object
Constructor Details
#initialize(str) ⇒ Alt
Returns a new instance of Alt.
7 8 9 |
# File 'lib/iqdb/client/parser/alt.rb', line 7 def initialize(str) @str = str end |
Instance Attribute Details
#str ⇒ Object (readonly)
Returns the value of attribute str.
5 6 7 |
# File 'lib/iqdb/client/parser/alt.rb', line 5 def str @str end |
Instance Method Details
#rating ⇒ Object
15 16 17 |
# File 'lib/iqdb/client/parser/alt.rb', line 15 def @rating ||= str.scan(/Rating:\s(\w)\s/).then { |m| m.empty? ? '' : m[0][0] } end |
#tags ⇒ Object
11 12 13 |
# File 'lib/iqdb/client/parser/alt.rb', line 11 def @tags ||= str.scan(/Tags:(.+)$/).then { |m| m.empty? ? [] : m[0][0].split(' ') } end |