Class: Cockroach::Config
- Inherits:
-
Object
- Object
- Cockroach::Config
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/cockroach/config.rb,
lib/cockroach/config/loader.rb
Defined Under Namespace
Classes: ConfigNotExistsError, Loader, MissingRootPathError
Class Attribute Summary collapse
-
.config_path ⇒ Object
Returns the value of attribute config_path.
-
.fixturer ⇒ Object
Returns the value of attribute fixturer.
-
.fixtures_path ⇒ Object
Returns the value of attribute fixtures_path.
-
.root ⇒ Object
Returns root folder for the project, of if one is missing it tries to return Rails.root, if Rails is not defined it will raise an error.
Instance Attribute Summary collapse
-
#fixtures_path ⇒ Object
readonly
Returns the value of attribute fixtures_path.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Instance Method Summary collapse
- #fixturer ⇒ Object
-
#initialize(path_to_config) ⇒ Config
constructor
A new instance of Config.
- #profiler ⇒ Object
Constructor Details
#initialize(path_to_config) ⇒ Config
Returns a new instance of Config.
29 30 31 32 33 34 |
# File 'lib/cockroach/config.rb', line 29 def initialize path_to_config @config_path = File. path_to_config, self.class.root @profile, @options = Cockroach::Config::Loader.parse(@config_path) @fixturer_def = get_option('fixturer') || self.class.fixturer || 'factory_girl' @fixtures_path = self.class.fixtures_path if self.class.fixtures_path end |
Class Attribute Details
.config_path ⇒ Object
Returns the value of attribute config_path.
12 13 14 |
# File 'lib/cockroach/config.rb', line 12 def config_path @config_path end |
.fixturer ⇒ Object
Returns the value of attribute fixturer.
12 13 14 |
# File 'lib/cockroach/config.rb', line 12 def fixturer @fixturer end |
.fixtures_path ⇒ Object
Returns the value of attribute fixtures_path.
12 13 14 |
# File 'lib/cockroach/config.rb', line 12 def fixtures_path @fixtures_path end |
.root ⇒ Object
Returns root folder for the project, of if one is missing it tries to return Rails.root, if Rails is not defined it will raise an error.
16 17 18 19 20 21 22 23 24 |
# File 'lib/cockroach/config.rb', line 16 def root @root ||= begin if defined?(Rails) File.join Rails.root else "./" end end end |
Instance Attribute Details
#fixtures_path ⇒ Object (readonly)
Returns the value of attribute fixtures_path.
27 28 29 |
# File 'lib/cockroach/config.rb', line 27 def fixtures_path @fixtures_path end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
27 28 29 |
# File 'lib/cockroach/config.rb', line 27 def @options end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
27 28 29 |
# File 'lib/cockroach/config.rb', line 27 def profile @profile end |
Instance Method Details
#fixturer ⇒ Object
36 37 38 |
# File 'lib/cockroach/config.rb', line 36 def fixturer @fixturer ||= @fixturer_def.to_s.camelize.to_sym end |
#profiler ⇒ Object
40 41 42 43 44 |
# File 'lib/cockroach/config.rb', line 40 def profiler @profiler ||= begin Cockroach.const_get(fixturer)::Profiler.new end end |