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
-
.gem_version ⇒ Object
Returns the version of the currently loaded Jasper as a
Gem::Version. - .load_sample(file_name) ⇒ Object
-
.version ⇒ Object
Returns the version of the currently loaded Jasper as a string.
Class Method Details
.gem_version ⇒ Object
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.(File.join(Rails.root, 'db', 'samples', "#{file_name}.rb")) else # Otherwise we will use this gems default file. path = File.(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 |