Class: Forklift::Base::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/forklift/base/utils.rb

Instance Method Summary collapse

Instance Method Details

#class_name_from_file(file) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/forklift/base/utils.rb', line 12

def class_name_from_file(file)
  klass = ""
  words = file.split("/").last.split(".").first.split("_")
  words.each do |word|
    klass << word.capitalize
  end
  klass
end

#load_yml(file) ⇒ Object



8
9
10
# File 'lib/forklift/base/utils.rb', line 8

def load_yml(file)
  YAML.load(ERB.new(File.read(file)).result)
end