Class: CodeModels::Language
- Inherits:
-
Object
- Object
- CodeModels::Language
- Defined in:
- lib/codemodels/language.rb
Instance Attribute Summary collapse
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
-
#filenames ⇒ Object
readonly
Returns the value of attribute filenames.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
- #can_parse?(path) ⇒ Boolean
-
#initialize(name) ⇒ Language
constructor
A new instance of Language.
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
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
11 12 13 |
# File 'lib/codemodels/language.rb', line 11 def extensions @extensions end |
#filenames ⇒ Object (readonly)
Returns the value of attribute filenames.
10 11 12 |
# File 'lib/codemodels/language.rb', line 10 def filenames @filenames end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/codemodels/language.rb', line 9 def name @name end |
#parser ⇒ Object (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 |