Class: JpStringsFinder::FiletypeDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/jp_strings_finder/filetype_detector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ FiletypeDetector

Returns a new instance of FiletypeDetector.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jp_strings_finder/filetype_detector.rb', line 5

def initialize(file_path)
  @filetype =
    case File.extname(file_path)
    when ".rb"
      :ruby
    when ".erb"
      :erb
    when ".slim"
      :slim
    else
      raise "Unsupported filetype [#{file_path}]"
    end
end

Instance Attribute Details

#filetypeObject (readonly)

Returns the value of attribute filetype.



3
4
5
# File 'lib/jp_strings_finder/filetype_detector.rb', line 3

def filetype
  @filetype
end