Class: Exlibris::Aleph::Table::Reader::Matcher::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/exlibris/aleph/table/reader/matcher/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(regexp, string) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/exlibris/aleph/table/reader/matcher/base.rb', line 9

def initialize(regexp, string)
  @regexp = regexp
  @string = string
end

Instance Attribute Details

#regexpObject (readonly)

Returns the value of attribute regexp.



7
8
9
# File 'lib/exlibris/aleph/table/reader/matcher/base.rb', line 7

def regexp
  @regexp
end

#stringObject (readonly)

Returns the value of attribute string.



7
8
9
# File 'lib/exlibris/aleph/table/reader/matcher/base.rb', line 7

def string
  @string
end

Instance Method Details

#match_dataObject



14
15
16
# File 'lib/exlibris/aleph/table/reader/matcher/base.rb', line 14

def match_data
  @match_data ||= regexp.match(string)
end

#matched_dataObject



18
19
20
# File 'lib/exlibris/aleph/table/reader/matcher/base.rb', line 18

def matched_data
  @matched_data ||= match_data.captures
end

#matches?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/exlibris/aleph/table/reader/matcher/base.rb', line 22

def matches?
  regexp === string
end