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.
11 12 13 14 |
# File 'lib/codemodels/language.rb', line 11 def initialize(name) @name = name @extensions = [] end |
Instance Attribute Details
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
8 9 10 |
# File 'lib/codemodels/language.rb', line 8 def extensions @extensions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/codemodels/language.rb', line 7 def name @name end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
9 10 11 |
# File 'lib/codemodels/language.rb', line 9 def parser @parser end |
Instance Method Details
#can_parse?(path) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/codemodels/language.rb', line 16 def can_parse?(path) extension = File.extname(path) extension=extension[1..-1] if extension.length>0 @extensions.include?(extension) end |