Class: RBeautify::Language
- Defined in:
- lib/ruby-beautify/lib/ruby-beautify/language.rb
Constant Summary collapse
- @@languages =
{}
Instance Attribute Summary collapse
-
#indent_size ⇒ Object
Returns the value of attribute indent_size.
-
#matchers ⇒ Object
readonly
Returns the value of attribute matchers.
Class Method Summary collapse
Instance Method Summary collapse
- #add_matcher(name, starts, ends, options = {}) ⇒ Object
-
#initialize ⇒ Language
constructor
A new instance of Language.
- #matcher(name) ⇒ Object
Constructor Details
#initialize ⇒ Language
Returns a new instance of Language.
24 25 26 |
# File 'lib/ruby-beautify/lib/ruby-beautify/language.rb', line 24 def initialize @matchers = [] end |
Instance Attribute Details
#indent_size ⇒ Object
Returns the value of attribute indent_size.
7 8 9 |
# File 'lib/ruby-beautify/lib/ruby-beautify/language.rb', line 7 def indent_size @indent_size end |
#matchers ⇒ Object (readonly)
Returns the value of attribute matchers.
6 7 8 |
# File 'lib/ruby-beautify/lib/ruby-beautify/language.rb', line 6 def matchers @matchers end |
Class Method Details
.add_language(name) ⇒ Object
19 20 21 |
# File 'lib/ruby-beautify/lib/ruby-beautify/language.rb', line 19 def add_language(name) languages[name] = new() end |
.language(name) ⇒ Object
11 12 13 |
# File 'lib/ruby-beautify/lib/ruby-beautify/language.rb', line 11 def language(name) languages[name] end |
.languages ⇒ Object
15 16 17 |
# File 'lib/ruby-beautify/lib/ruby-beautify/language.rb', line 15 def languages @@languages end |
Instance Method Details
#add_matcher(name, starts, ends, options = {}) ⇒ Object
28 29 30 |
# File 'lib/ruby-beautify/lib/ruby-beautify/language.rb', line 28 def add_matcher(name, starts, ends, = {}) self.matchers << BlockMatcher.new(self, name, starts, ends, ) end |
#matcher(name) ⇒ Object
32 33 34 |
# File 'lib/ruby-beautify/lib/ruby-beautify/language.rb', line 32 def matcher(name) self.matchers.detect { |matcher| matcher.name == name} end |