Class: CodeModels::Language

Inherits:
Object
  • Object
show all
Defined in:
lib/codemodels/language.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Language



14
15
16
17
18
# File 'lib/codemodels/language.rb', line 14

def initialize(name)
  @name = name
  @extensions = []
  @filenames = []
end

Instance Attribute Details

#extensionsObject (readonly)

Returns the value of attribute extensions.



11
12
13
# File 'lib/codemodels/language.rb', line 11

def extensions
  @extensions
end

#filenamesObject (readonly)

Returns the value of attribute filenames.



10
11
12
# File 'lib/codemodels/language.rb', line 10

def filenames
  @filenames
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/codemodels/language.rb', line 9

def name
  @name
end

#parserObject (readonly)

Returns the value of attribute parser.



12
13
14
# File 'lib/codemodels/language.rb', line 12

def parser
  @parser
end

Instance Method Details

#can_parse?(path) ⇒ Boolean



20
21
22
23
24
25
# File 'lib/codemodels/language.rb', line 20

def can_parse?(path)
  simple_name = Pathname.new(path).basename.to_s
  extension = File.extname(path)
  extension=extension[1..-1] if extension.length>0   
  @extensions.include?(extension) || @filenames.include?(simple_name) 
end