Class: EveApp::ItemParser::Line
- Inherits:
-
Object
- Object
- EveApp::ItemParser::Line
- Defined in:
- lib/eve_app/item_parser.rb
Constant Summary collapse
- REGEX =
/(?<=\s|\t|^)(x?\s?[0-9]+\s?x?)(?=\s|\t|$)/i
Instance Attribute Summary collapse
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#quantity_words ⇒ Object
readonly
Returns the value of attribute quantity_words.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(text) ⇒ Line
constructor
A new instance of Line.
- #valid? ⇒ Boolean
Constructor Details
#initialize(text) ⇒ Line
Returns a new instance of Line.
71 72 73 74 75 76 77 |
# File 'lib/eve_app/item_parser.rb', line 71 def initialize(text) @text = text @parts = text.split(/\t/) @quantity_words = find_quantity_words @type = EveApp::Type.where(name: search_strings).first @quantity = find_quantity if type end |
Instance Attribute Details
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
69 70 71 |
# File 'lib/eve_app/item_parser.rb', line 69 def parts @parts end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
69 70 71 |
# File 'lib/eve_app/item_parser.rb', line 69 def quantity @quantity end |
#quantity_words ⇒ Object (readonly)
Returns the value of attribute quantity_words.
69 70 71 |
# File 'lib/eve_app/item_parser.rb', line 69 def quantity_words @quantity_words end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
69 70 71 |
# File 'lib/eve_app/item_parser.rb', line 69 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
69 70 71 |
# File 'lib/eve_app/item_parser.rb', line 69 def type @type end |
Instance Method Details
#valid? ⇒ Boolean
79 80 81 |
# File 'lib/eve_app/item_parser.rb', line 79 def valid? !!type end |