cushion_defaults 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cushion_defaults/configuration.rb +1 -1
- data/lib/cushion_defaults.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be31769619d31078b95f3ce90c4dbe1e23948d0
|
4
|
+
data.tar.gz: 0f883a5d3b1721e29abc6588ee4fc5be86d9a7a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f71ace7a7cd19e962f49333ad57192acf18fa82752e93bab345ce5f89321091e4df00cb8c7778d4da650b19632e238d57a2bd38364fe5acf299fbbee043ca92d
|
7
|
+
data.tar.gz: f65b07dfb5c5d58e8220c16c0d47fa1968b19269d9fdcf923d94ccc7f0d988afae8fe426452c2dd6132d4e7d8e3fe4516c8179f215a1b2bb2545682f8443b4f1
|
@@ -19,7 +19,7 @@ class Configuration # :nodoc:
|
|
19
19
|
# +loaded_config+ :: hash from which options will be derived
|
20
20
|
def from_hash(loaded_config)
|
21
21
|
loaded_config.each do |key, val|
|
22
|
-
instance_variable_set(key.to_sym, val) if instance_variable_defined? key.to_sym
|
22
|
+
instance_variable_set("@#{key.to_sym}", val) if instance_variable_defined? "@#{key.to_sym}"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/lib/cushion_defaults.rb
CHANGED
@@ -10,15 +10,15 @@ require 'cushion_defaults/defaults_hash'
|
|
10
10
|
# +Klass+.
|
11
11
|
module CushionDefaults
|
12
12
|
|
13
|
-
VERSION = '0.0.
|
13
|
+
VERSION = '0.0.3'
|
14
14
|
|
15
15
|
# CONFIG
|
16
16
|
|
17
17
|
# Location CushionDefaults looks for (optional) config file
|
18
|
-
CONFIG_LOCATION = 'config/cushion_defaults.yaml'
|
19
|
-
|
20
18
|
CALLING_PATH = File.expand_path(File.dirname($0)) + '/'
|
21
19
|
|
20
|
+
CONFIG_LOCATION = CALLING_PATH + 'config/cushion_defaults.yaml'
|
21
|
+
|
22
22
|
# If set to true, will automatically look at +YAML_PATH+ for each class that includes +CushionDefaults+ to try to
|
23
23
|
# load defaults from yaml file located at the result of +YAML_PROC+. By default, this would be 'config/klass.yaml'.
|
24
24
|
|
@@ -64,13 +64,13 @@ module CushionDefaults
|
|
64
64
|
|
65
65
|
if File.exists?(CONFIG_LOCATION)
|
66
66
|
t = File.open(CONFIG_LOCATION)
|
67
|
-
elsif File.exists?(configuration.yaml_source_folder + 'cushion_defaults.yaml')
|
68
|
-
t = File.open(configuration.yaml_source_folder + 'cushion_defaults.yaml')
|
67
|
+
elsif File.exists?(CALLING_PATH + configuration.yaml_source_folder + 'cushion_defaults.yaml')
|
68
|
+
t = File.open(CALLING_PATH + configuration.yaml_source_folder + 'cushion_defaults.yaml')
|
69
69
|
else
|
70
70
|
t = nil
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
conf.from_hash(YAML::load(t)) if t
|
74
74
|
|
75
75
|
# Add class methods and set up +DefaultsHash+ when the module is included in a class.
|
76
76
|
#
|