configulations 0.1.1 → 0.1.2
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.
- data/VERSION +1 -1
- data/configulations.gemspec +2 -1
- data/lib/configulations.rb +5 -0
- data/lib/magic_hash.rb +2 -2
- data/spec/sample_spec.rb +10 -0
- data/spec/spec_helper.rb +3 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/configulations.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{configulations}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Leon Gersing"]
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/magic_hash.rb",
|
34
34
|
"spec/configurator_spec.rb",
|
35
35
|
"spec/magic_hash_spec.rb",
|
36
|
+
"spec/sample_spec.rb",
|
36
37
|
"spec/spec_helper.rb"
|
37
38
|
]
|
38
39
|
s.homepage = %q{http://github.com/leongersing/configulations}
|
data/lib/configulations.rb
CHANGED
@@ -32,6 +32,11 @@ class Configulations
|
|
32
32
|
def method_missing(message_name, *message_arguments, &optional_block)
|
33
33
|
result = properties.send message_name.to_sym, *message_arguments
|
34
34
|
return result if result
|
35
|
+
message = message_name.to_s.strip.gsub(/-/,"_")
|
36
|
+
if message.to_s =~ /=/
|
37
|
+
properties[message.gsub(/=/,"").to_sym] = message_arguments.flatten.first
|
38
|
+
return
|
39
|
+
end
|
35
40
|
super message_name, *message_arguments, &optional_block
|
36
41
|
end
|
37
42
|
end
|
data/lib/magic_hash.rb
CHANGED
@@ -10,7 +10,7 @@ module MagicHash
|
|
10
10
|
tmp={}
|
11
11
|
tmp.extend(MagicHash)
|
12
12
|
self.each_pair do |key, value|
|
13
|
-
new_key = key.gsub(/\s|-/,"_").to_sym
|
13
|
+
new_key = key.gsub(/\s|-/,"_").strip.to_sym
|
14
14
|
if(value.is_a? Hash)
|
15
15
|
value.extend(MagicHash) unless value.respond_to? :objectify
|
16
16
|
tmp[new_key] = value.make_keys_valid_message_aliases
|
@@ -55,7 +55,7 @@ module MagicHash
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def method_missing(method_name, *args, &blk)
|
58
|
-
message = method_name.to_s.downcase.gsub(/-/,"_").to_sym
|
58
|
+
message = method_name.to_s.strip.downcase.gsub(/-/,"_").to_sym
|
59
59
|
if message =~ /=/
|
60
60
|
self[message]= args.flatten.first
|
61
61
|
return
|
data/spec/sample_spec.rb
ADDED
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,9 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
3
3
|
require 'rspec'
|
4
4
|
require 'configulations'
|
5
5
|
|
6
|
+
MyConfig = Configulations.new
|
7
|
+
MyConfig.root = "/usr/local/bin/awesome"
|
8
|
+
|
6
9
|
# Requires supporting files with custom matchers and macros, etc,
|
7
10
|
# in ./support/ and its subdirectories.
|
8
11
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: configulations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Leon Gersing
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/magic_hash.rb
|
84
84
|
- spec/configurator_spec.rb
|
85
85
|
- spec/magic_hash_spec.rb
|
86
|
+
- spec/sample_spec.rb
|
86
87
|
- spec/spec_helper.rb
|
87
88
|
has_rdoc: true
|
88
89
|
homepage: http://github.com/leongersing/configulations
|
@@ -98,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
99
|
requirements:
|
99
100
|
- - ">="
|
100
101
|
- !ruby/object:Gem::Version
|
101
|
-
hash:
|
102
|
+
hash: 3543635930889180181
|
102
103
|
segments:
|
103
104
|
- 0
|
104
105
|
version: "0"
|