Class: Generated::Grammar

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#informationString

Returns information for contributers.

Returns:

  • (String)

    information for contributers



12
13
14
# File 'lib/ruby_grammar_builder/generated/grammar.rb', line 12

def information
  @information
end

#nameString

Returns The name of the grammar.

Returns:

  • (String)

    The name of the grammar



6
7
8
# File 'lib/ruby_grammar_builder/generated/grammar.rb', line 6

def name
  @name
end

#other_propertiesHash

Returns other properties.

Returns:

  • (Hash)

    other properties



18
19
20
# File 'lib/ruby_grammar_builder/generated/grammar.rb', line 18

def other_properties
  @other_properties
end

#patternsPatternRule

Returns rules in initial scope.

Returns:



14
15
16
# File 'lib/ruby_grammar_builder/generated/grammar.rb', line 14

def patterns
  @patterns
end

#repositoryHash<String=>Rule>

Returns the repository of rules.

Returns:

  • (Hash<String=>Rule>)

    the repository of rules



16
17
18
# File 'lib/ruby_grammar_builder/generated/grammar.rb', line 16

def repository
  @repository
end

#scope_nameString

Returns The grammars scope.

Returns:

  • (String)

    The grammars scope



8
9
10
# File 'lib/ruby_grammar_builder/generated/grammar.rb', line 8

def scope_name
  @scope_name
end

#versionString

Returns The version of the grammar.

Returns:

  • (String)

    The version of the grammar



10
11
12
# File 'lib/ruby_grammar_builder/generated/grammar.rb', line 10

def version
  @version
end

Instance Method Details

#to_hObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ruby_grammar_builder/generated/grammar.rb', line 20

def to_h
    default = {
        "name" => @name,
        "scopeName" => @scope_name,
        "version" => @version,
        "information_for_contributors" => @information,
        "repository" => @repository.transform_values(&:to_h),
    }

    other_properties.merge(default).merge(@patterns.to_h)
end