Module: Jasper::Sample

Defined in:
lib/jasper/sample.rb,
lib/jasper/sample/engine.rb,
lib/jasper/sample/version.rb,
lib/jasper/sample/gem_version.rb

Defined Under Namespace

Modules: VERSION Classes: Engine

Class Method Summary collapse

Class Method Details

.gem_versionObject

Returns the version of the currently loaded Jasper as a Gem::Version



5
6
7
# File 'lib/jasper/sample/gem_version.rb', line 5

def self.gem_version
  Gem::Version.new VERSION::STRING
end

.load_sample(file_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jasper/sample.rb', line 7

def self.load_sample(file_name)
  # If file exists within application it takes precedence.
  if File.exists?(File.join(Rails.root, 'db', 'samples', "#{file_name}.rb"))
    path = File.expand_path(File.join(Rails.root, 'db', 'samples', "#{file_name}.rb"))
  else
    # Otherwise we will use this gems default file.
    path = File.expand_path(samples_path + "#{file_name}.rb")
  end

  # Check to see if the specified file has been loaded before
  unless $LOADED_FEATURES.include?(path)
    require path
    puts "Loaded #{file_name.titleize} samples"
  end
end

.versionObject

Returns the version of the currently loaded Jasper as a string.



7
8
9
# File 'lib/jasper/sample/version.rb', line 7

def self.version
  VERSION::STRING
end