Class: EveApp::ItemParser

Inherits:
Object
  • Object
show all
Defined in:
lib/eve_app/item_parser.rb

Defined Under Namespace

Classes: Header, Line

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ ItemParser

Returns a new instance of ItemParser.



5
6
7
8
9
10
11
# File 'lib/eve_app/item_parser.rb', line 5

def initialize(text)
  @text = text
  @lines = []

  normalized_lines
  determine_items
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



3
4
5
# File 'lib/eve_app/item_parser.rb', line 3

def header
  @header
end

#itemsObject (readonly)

Returns the value of attribute items.



3
4
5
# File 'lib/eve_app/item_parser.rb', line 3

def items
  @items
end

#linesObject (readonly)

Returns the value of attribute lines.



3
4
5
# File 'lib/eve_app/item_parser.rb', line 3

def lines
  @lines
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/eve_app/item_parser.rb', line 3

def text
  @text
end

Instance Method Details

#header?Boolean

Returns:

  • (Boolean)


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

def header?
  !!header
end

#shipsObject



17
18
19
# File 'lib/eve_app/item_parser.rb', line 17

def ships
  @_ships ||= items.select(&:ship?)
end