Class: Versionomy::Format::Delimiter::RegexpStringRecognizer
- Inherits:
-
RecognizerBase
- Object
- RecognizerBase
- Versionomy::Format::Delimiter::RegexpStringRecognizer
- Defined in:
- lib/versionomy/format/delimiter.rb
Overview
A recognizer for strings that match a particular given regular expression, for use in string-valued fields.
Instance Method Summary collapse
-
#initialize(field_, regexp_ = '[a-zA-Z0-9]+', opts_ = {}) ⇒ RegexpStringRecognizer
constructor
:nodoc:.
- #parsed_value(value_, parse_params_) ⇒ Object
- #unparsed_value(value_, style_, unparse_params_) ⇒ Object
Methods inherited from RecognizerBase
#parse, #requires_next_field, #setup, #should_unparse?, #unparse
Constructor Details
#initialize(field_, regexp_ = '[a-zA-Z0-9]+', opts_ = {}) ⇒ RegexpStringRecognizer
:nodoc:
966 967 968 |
# File 'lib/versionomy/format/delimiter.rb', line 966 def initialize(field_, regexp_='[a-zA-Z0-9]+', opts_={}) setup(field_, regexp_, opts_) end |
Instance Method Details
#parsed_value(value_, parse_params_) ⇒ Object
970 971 972 |
# File 'lib/versionomy/format/delimiter.rb', line 970 def parsed_value(value_, parse_params_) [value_, nil] end |
#unparsed_value(value_, style_, unparse_params_) ⇒ Object
974 975 976 |
# File 'lib/versionomy/format/delimiter.rb', line 974 def unparsed_value(value_, style_, unparse_params_) value_.to_s end |