Class: Line

Inherits:
Object
  • Object
show all
Defined in:
lib/aml/Line.rb

Overview

Convert a string input to a Hash output.

Instance Method Summary collapse

Constructor Details

#initialize(bundle, type, regex) ⇒ Line

Create a new Line with a symbol type and regular expression.



4
5
6
7
8
9
# File 'lib/aml/Line.rb', line 4

def initialize(bundle, type, regex)
	@line = {}
	@line[:type] = type
	@line[:regex] = regex
	@line[:bundle] = bundle
end

Instance Method Details

#match?(string, number) ⇒ Boolean

Return a Hash if the line match is successful, otherwise false.

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/aml/Line.rb', line 11

def match?(string,number)
	match = string.match(@line[:regex])
	match ? process_match(match,number) : false
end