Class: Generated::BeginEndRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/ruby_grammar_builder/generated/rule.rb

Instance Attribute Summary collapse

Attributes inherited from Rule

#location

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ BeginEndRule

Returns a new instance of BeginEndRule.



99
100
101
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 99

def initialize(location)
    super(location)
end

Instance Attribute Details

#beginString

Returns The begin pattern.

Returns:

  • (String)

    The begin pattern



87
88
89
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 87

def begin
  @begin
end

#beginCapturesHash<String=>Rule>

Returns The captures rules for begin.

Returns:

  • (Hash<String=>Rule>)

    The captures rules for begin



95
96
97
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 95

def beginCaptures
  @beginCaptures
end

#contentNameString?

Returns The name for the contents matched.

Returns:

  • (String, nil)

    The name for the contents matched



93
94
95
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 93

def contentName
  @contentName
end

#endString

Returns The end pattern.

Returns:

  • (String)

    The end pattern



89
90
91
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 89

def end
  @end
end

#endCapturesHash<String=>Rule>

Returns The captures rules for end.

Returns:

  • (Hash<String=>Rule>)

    The captures rules for end



97
98
99
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 97

def endCaptures
  @endCaptures
end

#nameString?

Returns The name for this rule.

Returns:

  • (String, nil)

    The name for this rule



91
92
93
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 91

def name
  @name
end

Instance Method Details

#to_hObject



103
104
105
106
107
108
109
110
111
112
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 103

def to_h
    {
        "begin" => @begin,
        "end" => @end,
        "name" => @name,
        "contentName" => @contentName,
        "beginCaptures" => @beginCaptures.transform_values(&:to_h),
        "endCaptures" => @endCaptures.transform_values(&:to_h),
    }.compact
end