Module: My::Config
Overview
My::Config is the wrapper around all configurable options within the My gem. It tracks the version of the My gem, the environment in which My has been run, and the location of the My script registry.
Instance Attribute Summary collapse
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#scripts ⇒ Object
Returns the location of the My script registry, depending on the current environment.
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
15 16 17 |
# File 'lib/my/config.rb', line 15 def environment @environment end |
#version ⇒ Object
Returns the value of attribute version.
15 16 17 |
# File 'lib/my/config.rb', line 15 def version @version end |
Instance Method Details
#scripts ⇒ Object
Returns the location of the My script registry, depending on the current environment.
My::Config.environment = 'production'
My::Config.scripts
# => "/home/gisikw/.my_scripts"
My::Config.environment = 'test'
My::Config.scripts
# => "/home/gisikw/.rvm/gems/ruby-1.8.7-p249/gems/my-0.3.1/test.yml"
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/my/config.rb', line 27 def scripts case self.environment||='production' when /^production$/ return File.("~/.my_scripts") when /^test$/ return File.(File.join(File.dirname(__FILE__),'../../test.yml')) when /^cucumber$/ return File.(File.join(File.dirname(__FILE__),'../../test.yml')) end end |