Class: RBeautify::Language

Inherits:
Object show all
Defined in:
lib/ruby-beautify/lib/ruby-beautify/language.rb

Constant Summary collapse

@@languages =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLanguage

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_sizeObject

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

#matchersObject (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

.languagesObject



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, options = {})
  self.matchers << BlockMatcher.new(self, name, starts, ends, options)
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