Class: It::Parser
- Inherits:
-
Object
- Object
- It::Parser
- Defined in:
- lib/it/parser.rb
Constant Summary collapse
- INTERPOLATION_REGEXP =
/%\{[^{}}]+\}/
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#string ⇒ Object
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(string, options) ⇒ Parser
constructor
A new instance of Parser.
- #process ⇒ Object
Constructor Details
#initialize(string, options) ⇒ Parser
Returns a new instance of Parser.
7 8 9 10 |
# File 'lib/it/parser.rb', line 7 def initialize(string, ) self.string = string self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/it/parser.rb', line 3 def @options end |
#string ⇒ Object
Returns the value of attribute string.
3 4 5 |
# File 'lib/it/parser.rb', line 3 def string @string end |
Instance Method Details
#process ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/it/parser.rb', line 12 def process handle_pluralization escape_string # For deep nesting, we repeat the process until we have no interpolations anymore while has_interpolation? self.string.gsub!(INTERPOLATION_REGEXP) do |interpolation| Interpolation.new(interpolation, ).process end end string.html_safe end |