kung_figure 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
- = Simple Rest
1
+ = Kung-Figure
2
2
 
3
- * http://github.com/niquola/kung_figure
3
+ http://github.com/niquola/kung_figure
4
4
 
5
5
  == DESCRIPTION
6
6
 
@@ -38,7 +38,7 @@ Example:
38
38
  end
39
39
  end
40
40
 
41
- This will add method configure,config,load_config into MyModule:
41
+ This will mixin methods configure, config, load_config into MyModule:
42
42
 
43
43
  MyModule.configure do
44
44
  prop1 'new value'
@@ -69,6 +69,7 @@ to get similar result:
69
69
  end
70
70
 
71
71
  def meth
72
+ #here we can use config inside instance
72
73
  config.my_config
73
74
  end
74
75
  end
@@ -84,10 +85,18 @@ Or inside instances of WorkHorse as config method.
84
85
  == CHANGE LOG
85
86
 
86
87
  * 0.0.2 add MyModule.clear_config! (clear configs for all nested configs) and MyModule.clear_config (clear concrete configs) and KungFigure.clear_all_configs methods
88
+ * 0.0.3 fix bug with boolean configs
87
89
 
88
90
  == TODO
89
91
 
90
- * Give the posibility clear one branch of configs
92
+ * add another configuration style
93
+
94
+ Mod.confugure do |m|
95
+ m.param 'value'
96
+ m.nested_config |nc|
97
+ nc.param1 'value2'
98
+ end
99
+ end
91
100
 
92
101
  == MORE
93
102
 
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ PKG_FILES = FileList[ '[a-zA-Z]*', 'generators/**/*', 'lib/**/*', 'rails/**/*',
28
28
 
29
29
  spec = Gem::Specification.new do |s|
30
30
  s.name = "kung_figure"
31
- s.version = "0.0.2"
31
+ s.version = "0.0.3"
32
32
  s.author = "niquola"
33
33
  s.email = "niquola@gmail.com"
34
34
  s.homepage = "http://github.com/niquola/kung_figure"
@@ -76,7 +76,7 @@ module KungFigure
76
76
  if args.length > 0
77
77
  @props[name] = args[0]
78
78
  else
79
- @props[name] || default
79
+ @props.key?(name) ? @props[name] : default
80
80
  end
81
81
  end
82
82
  end
@@ -5,6 +5,7 @@ module MyModule
5
5
  class Config < KungFigure::Base
6
6
  define_prop :prop1,'default1'
7
7
  define_prop :prop2, 2
8
+ define_prop :bool,true
8
9
 
9
10
  class NestedConfig < KungFigure::Base
10
11
  define_prop :prop3,'prop3'
@@ -52,6 +53,13 @@ class TestKungFigure < Test::Unit::TestCase
52
53
  assert_equal('value3',MyModule.config.nested_config.prop3)
53
54
  end
54
55
 
56
+ def test_bug_with_boolean
57
+ MyModule.configure do
58
+ bool false
59
+ end
60
+ assert_equal(false,MyModule.config.bool)
61
+ end
62
+
55
63
  def test_nested_config_declaration
56
64
  MyModule.clear_config!
57
65
  assert_equal('default',MyModule.config.work_horse.my_config)
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kung_figure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
5
11
  platform: ruby
6
12
  authors:
7
13
  - niquola
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-03-10 00:00:00 +03:00
18
+ date: 2010-09-09 00:00:00 +04:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -37,21 +43,27 @@ rdoc_options: []
37
43
  require_paths:
38
44
  - lib
39
45
  required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
40
47
  requirements:
41
48
  - - ">="
42
49
  - !ruby/object:Gem::Version
50
+ hash: 3
51
+ segments:
52
+ - 0
43
53
  version: "0"
44
- version:
45
54
  required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
46
56
  requirements:
47
57
  - - ">="
48
58
  - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
49
62
  version: "0"
50
- version:
51
63
  requirements: []
52
64
 
53
65
  rubyforge_project:
54
- rubygems_version: 1.3.5
66
+ rubygems_version: 1.3.7
55
67
  signing_key:
56
68
  specification_version: 3
57
69
  summary: Ruby configuration DSL base