Class: Syntaxer::LanguageRules

Inherits:
Array
  • Object
show all
Defined in:
lib/syntaxer/language_definition.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) <<(smth)



26
27
28
29
# File 'lib/syntaxer/language_definition.rb', line 26

def << (smth)
  raise LanguageDefinitionException.new "can't be other then LanguageDefinition class object" unless smth.is_a?(LanguageDefinition)
  super        
end

- (Object) find(name)



40
41
42
# File 'lib/syntaxer/language_definition.rb', line 40

def find(name)
  self.detect{|ld| ld.name == name}
end

- (Object) find_or_create(name)



31
32
33
34
35
36
37
38
# File 'lib/syntaxer/language_definition.rb', line 31

def find_or_create(name)
  found = find(name) 
  unless found
    found = LanguageDefinition.new(name)
    self << found
  end
  found
end