Module: Lightr::Grammar::InstanceMethods
- Defined in:
- lib/lightr/mixins/grammar.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute output.
Instance Method Summary collapse
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
16 17 18 |
# File 'lib/lightr/mixins/grammar.rb', line 16 def input @input end |
#output ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute output.
16 17 18 |
# File 'lib/lightr/mixins/grammar.rb', line 16 def output @output end |
Instance Method Details
#escape(string) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/lightr/mixins/grammar.rb', line 27 def escape string string. gsub(/&/, '&'). gsub(/</, '<'). gsub(/>/, '>'). gsub(/"/, '"') end |
#initialize(input) ⇒ Object
19 20 21 |
# File 'lib/lightr/mixins/grammar.rb', line 19 def initialize input @input, @output = input, '' end |
#parse! ⇒ Object
23 24 25 |
# File 'lib/lightr/mixins/grammar.rb', line 23 def parse! parse @input end |