Class: AsciiDataTools::RecordType::Field::RegexpConstraint
- Inherits:
-
Constraint
- Object
- Constraint
- AsciiDataTools::RecordType::Field::RegexpConstraint
- Defined in:
- lib/ascii-data-tools/record_type/field.rb
Instance Method Summary collapse
- #extend_regexp_string_for_matching(regexp_string) ⇒ Object
-
#initialize(regexp_that_must_match) ⇒ RegexpConstraint
constructor
A new instance of RegexpConstraint.
- #satisfied_by?(string) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(regexp_that_must_match) ⇒ RegexpConstraint
Returns a new instance of RegexpConstraint.
150 151 152 |
# File 'lib/ascii-data-tools/record_type/field.rb', line 150 def initialize(regexp_that_must_match) @regexp_that_must_match = regexp_that_must_match end |
Instance Method Details
#extend_regexp_string_for_matching(regexp_string) ⇒ Object
154 155 156 |
# File 'lib/ascii-data-tools/record_type/field.rb', line 154 def extend_regexp_string_for_matching(regexp_string) regexp_string + @regexp_that_must_match.source end |
#satisfied_by?(string) ⇒ Boolean
158 159 160 |
# File 'lib/ascii-data-tools/record_type/field.rb', line 158 def satisfied_by?(string) string =~ @regexp_that_must_match end |
#to_s ⇒ Object
162 163 164 |
# File 'lib/ascii-data-tools/record_type/field.rb', line 162 def to_s "=~ #{@regexp_that_must_match.inspect}" end |