Class: JsRegex::Conversion
- Inherits:
-
Object
- Object
- JsRegex::Conversion
- Defined in:
- lib/js_regex/conversion.rb
Overview
This class acts as a facade, creating specific Converters and passing Regexp::Scanner tokens to them, reusing Converters as needed.
::of returns a source String, options String, and warnings Array.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#ruby_regex ⇒ Object
readonly
Returns the value of attribute ruby_regex.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ruby_regex) ⇒ Conversion
constructor
A new instance of Conversion.
Constructor Details
#initialize(ruby_regex) ⇒ Conversion
Returns a new instance of Conversion.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/js_regex/conversion.rb', line 14 def initialize(ruby_regex) @ruby_regex = ruby_regex @source = '' @options = '' @warnings = [] convert_source(ruby_regex) (ruby_regex) perform_sanity_check end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/js_regex/conversion.rb', line 12 def @options end |
#ruby_regex ⇒ Object (readonly)
Returns the value of attribute ruby_regex.
12 13 14 |
# File 'lib/js_regex/conversion.rb', line 12 def ruby_regex @ruby_regex end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
12 13 14 |
# File 'lib/js_regex/conversion.rb', line 12 def source @source end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
12 13 14 |
# File 'lib/js_regex/conversion.rb', line 12 def warnings @warnings end |
Class Method Details
.of(ruby_regex) ⇒ Object
25 26 27 28 |
# File 'lib/js_regex/conversion.rb', line 25 def self.of(ruby_regex) conversion = new(ruby_regex) [conversion.source, conversion., conversion.warnings] end |