Class: Mumuki::Laboratory::File

Inherits:
Object
  • Object
show all
Defined in:
lib/mumuki/laboratory/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/laboratory/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/laboratory/file.rb', line 3

def content
  @content
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#extensionObject



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

def extension
  name.get_file_extension
end

#highlight_modeObject



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

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