class SublimeSyntaxConvertor::MatchPattern

Attributes

captures[R]
comment[R]
match[R]
scope[R]

Public Class Methods

new(pat) click to toggle source
# File lib/sublime_syntax_convertor/patterns.rb, line 8
def initialize(pat)
  @match = format_regex(pat['match'])
  @scope = pat['name'] if pat.key?('name')
  @captures = format_captures(pat['captures']) if pat.key?('captures')
  @comment = format_comment(pat['comment']) if pat.key?('comment') && !format_comment(pat['comment']).empty?
end

Public Instance Methods

to_h() click to toggle source
# File lib/sublime_syntax_convertor/patterns.rb, line 15
def to_h
  hash = {}
  hash['match'] = @match if @match
  hash['scope'] = @scope if @scope
  hash['captures'] = @captures if @captures
  hash['comment'] = @comment if @comment
  hash
end