Class: Mumuki::Domain::File

Inherits:
Object
  • Object
show all
Defined in:
lib/mumuki/domain/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contentObject (readonly)

Returns the value of attribute content.



3
4
5
# File 'lib/mumuki/domain/file.rb', line 3

def content
  @content
end

#nameObject (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

#extensionObject



14
15
16
# File 'lib/mumuki/domain/file.rb', line 14

def extension
  name.file_extension
end

#highlight_modeObject



10
11
12
# File 'lib/mumuki/domain/file.rb', line 10

def highlight_mode
  Language.find_by(extension: extension)&.highlight_mode || extension
end