Class: Tansaku::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/tansaku/path.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_by_type(type) ⇒ Object



5
6
7
# File 'lib/tansaku/path.rb', line 5

def self.get_by_type(type)
  new.get_by_type(type)
end

Instance Method Details

#get_by_type(type) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
# File 'lib/tansaku/path.rb', line 9

def get_by_type(type)
  raise ArgumentError, "Invalid type is given. #{type} is not supported." unless valid_type?(type)

  return all if type == "all"

  File.readlines(File.expand_path("./lists/#{type}.txt", __dir__))
end