Class: SublimeSyntaxConvertor::BeginEndPattern
- Inherits:
-
Object
- Object
- SublimeSyntaxConvertor::BeginEndPattern
- Includes:
- Formatter
- Defined in:
- lib/sublime_syntax_convertor/patterns.rb
Instance Attribute Summary collapse
-
#captures ⇒ Object
readonly
Returns the value of attribute captures.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#pop ⇒ Object
readonly
Returns the value of attribute pop.
Instance Method Summary collapse
-
#initialize(type, pattern) ⇒ BeginEndPattern
constructor
A new instance of BeginEndPattern.
- #to_h ⇒ Object
Methods included from Formatter
#format_captures, #format_comment, #format_external_syntax, #format_regex, #leading_whitespace, #needs_quoting?, #quote
Constructor Details
#initialize(type, pattern) ⇒ BeginEndPattern
Returns a new instance of BeginEndPattern.
29 30 31 32 33 34 35 |
# File 'lib/sublime_syntax_convertor/patterns.rb', line 29 def initialize(type, pattern) @pattern = pattern @type = type @match = format_regex(pattern[type]) @pop = true if type == 'end' handle_captures end |
Instance Attribute Details
#captures ⇒ Object (readonly)
Returns the value of attribute captures.
27 28 29 |
# File 'lib/sublime_syntax_convertor/patterns.rb', line 27 def captures @captures end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
27 28 29 |
# File 'lib/sublime_syntax_convertor/patterns.rb', line 27 def match @match end |
#pop ⇒ Object (readonly)
Returns the value of attribute pop.
27 28 29 |
# File 'lib/sublime_syntax_convertor/patterns.rb', line 27 def pop @pop end |
Instance Method Details
#to_h ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/sublime_syntax_convertor/patterns.rb', line 37 def to_h hash = {} hash['match'] = @match if @match hash['pop'] = @pop if @pop hash['captures'] = @captures if @captures hash end |