Class: Mocatra::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/mocatra/record.rb

Class Method Summary collapse

Class Method Details

.default_songObject



12
13
14
15
# File 'lib/mocatra/record.rb', line 12

def default_song
  path = "#{Mocatra::App.record_path}/index.yml"
  YAML.load(File.read(path))
end

.exist?(record) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/mocatra/record.rb', line 7

def exist?(record)
  record += 'index' if record =~ /\/$/
  File.exist?("#{Mocatra::App.record_path}/#{record}.yml")
end

.sing(record) ⇒ Object



17
18
19
20
21
# File 'lib/mocatra/record.rb', line 17

def sing(record)
  record += 'index' if record =~ /\/$/
  path = "#{Mocatra::App.record_path}/#{record}.yml"
  YAML.load(File.read(path))
end