Class: Stylio::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/stylio/app.rb

Instance Method Summary collapse

Instance Method Details

#choose_fixture(path, name) ⇒ Object



104
105
106
107
108
109
110
# File 'lib/stylio/app.rb', line 104

def choose_fixture(path, name)
  if File.exists?(File.join("#{path}/#{ name }.yml.erb"))
    YAML.load(erb(:"#{path}/#{ name }.yml"))
  else
    YAML.load_file(File.join(path, "#{name}.yml"))
  end
end

#find_files(type) ⇒ Object



98
99
100
101
102
# File 'lib/stylio/app.rb', line 98

def find_files(type)
  root_folder = File.join(settings.app_path, type)
  directories = Dir.entries(root_folder).select {|f| !File.directory? f}
  directories.sort
end