Class: Mumuki::Domain::File
- Inherits:
-
Object
- Object
- Mumuki::Domain::File
- Defined in:
- lib/mumuki/domain/file.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #extension ⇒ Object
- #highlight_mode ⇒ Object
-
#initialize(name, content) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(name, content) ⇒ File
Returns a new instance of File.
5 6 7 8 |
# File 'lib/mumuki/domain/file.rb', line 5 def initialize(name, content) @name = name @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
3 4 5 |
# File 'lib/mumuki/domain/file.rb', line 3 def content @content end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/mumuki/domain/file.rb', line 3 def name @name end |
Instance Method Details
#extension ⇒ Object
14 15 16 |
# File 'lib/mumuki/domain/file.rb', line 14 def extension name.file_extension end |
#highlight_mode ⇒ Object
10 11 12 |
# File 'lib/mumuki/domain/file.rb', line 10 def highlight_mode Language.find_by(extension: extension)&.highlight_mode || extension end |