Class: Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/KMQToolKitGem/helper.rb

Class Method Summary collapse

Class Method Details

.is_integer?(string) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/KMQToolKitGem/helper.rb', line 5

def self.is_integer?(string)
  true if Integer(string) rescue false
end

.write_to_file(absolute_file_path, template_path, bindings) ⇒ Object



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

def self.write_to_file(absolute_file_path, template_path, bindings)
  template = ERB.new File.new(template_path).read, nil, "%"
  File.open(absolute_file_path, 'w') do |f|
    text = template.result bindings
    f.write text
  end
end