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.
-
#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
Returns a new instance of Language.
38 39 40 41 |
# File 'lib/codemodels/language.rb', line 38 def initialize(name) @name = name @extensions = [] end |
Instance Attribute Details
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
35 36 37 |
# File 'lib/codemodels/language.rb', line 35 def extensions @extensions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
34 35 36 |
# File 'lib/codemodels/language.rb', line 34 def name @name end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
36 37 38 |
# File 'lib/codemodels/language.rb', line 36 def parser @parser end |
Instance Method Details
#can_parse?(path) ⇒ Boolean
43 44 45 46 47 |
# File 'lib/codemodels/language.rb', line 43 def can_parse?(path) extension = File.extname(path) extension=extension[1..-1] if extension.length>0 @extensions.include?(extension) end |