configuration 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README +42 -0
  2. data/config/e.rb +13 -0
  3. data/lib/configuration.rb +9 -1
  4. data/samples/e.rb +14 -0
  5. metadata +4 -2
data/README CHANGED
@@ -206,5 +206,47 @@ SAMPLES
206
206
  42.0
207
207
 
208
208
 
209
+ <========< samples/e.rb >========>
210
+
211
+ ~ > cat samples/e.rb
212
+
213
+ #
214
+ # configuration.rb uses a totally clean slate dsl for the block. if you need
215
+ # to access base Object methods you can do this
216
+ #
217
+
218
+ require 'configuration'
219
+
220
+ c = Configuration.for 'e'
221
+
222
+ p c.foo
223
+ p c.bar
224
+ p c.foobar
225
+
226
+
227
+
228
+ ~ > cat config/e.rb
229
+
230
+ Configuration.for('e'){
231
+ foo 42
232
+
233
+ if Send('respond_to?', 'foo')
234
+ bar 'forty-two'
235
+ end
236
+
237
+ respond_to = Method('bar')
238
+
239
+ if respond_to.call('bar')
240
+ foobar 42.0
241
+ end
242
+ }
243
+
244
+ ~ > ruby samples/e.rb
245
+
246
+ 42
247
+ "forty-two"
248
+ 42.0
249
+
250
+
209
251
  AUTHOR
210
252
  ara.t.howard@gmail.com
data/config/e.rb ADDED
@@ -0,0 +1,13 @@
1
+ Configuration.for('e'){
2
+ foo 42
3
+
4
+ if Send('respond_to?', 'foo')
5
+ bar 'forty-two'
6
+ end
7
+
8
+ respond_to = Method('bar')
9
+
10
+ if respond_to.call('bar')
11
+ foobar 42.0
12
+ end
13
+ }
data/lib/configuration.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  class Configuration
3
- Version = '0.0.3'
3
+ Version = '0.0.4'
4
4
  def Configuration.version() Version end
5
5
 
6
6
  Path = [
@@ -91,6 +91,14 @@ class Configuration
91
91
  code
92
92
  end
93
93
 
94
+ def Send(m, *a, &b)
95
+ Pure[self].send(m, *a, &b)
96
+ end
97
+
98
+ def Method m
99
+ Pure[self].send('method', m)
100
+ end
101
+
94
102
  def self.evaluate configuration, options = {}, &block
95
103
  dsl = new configuration
96
104
  Pure[dsl].instance_eval &block if block
data/samples/e.rb ADDED
@@ -0,0 +1,14 @@
1
+ #
2
+ # configuration.rb uses a totally clean slate dsl for the block. if you need
3
+ # to access base Object methods you can do this
4
+ #
5
+
6
+ require 'configuration'
7
+
8
+ c = Configuration.for 'e'
9
+
10
+ p c.foo
11
+ p c.bar
12
+ p c.foobar
13
+
14
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configuration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
@@ -9,7 +9,7 @@ autorequire: configuration
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-12 00:00:00 -07:00
12
+ date: 2008-02-19 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -27,6 +27,7 @@ files:
27
27
  - config/b.rb
28
28
  - config/c.rb
29
29
  - config/d.rb
30
+ - config/e.rb
30
31
  - gemspec.rb
31
32
  - gen_readme.rb
32
33
  - install.rb
@@ -38,6 +39,7 @@ files:
38
39
  - samples/b.rb
39
40
  - samples/c.rb
40
41
  - samples/d.rb
42
+ - samples/e.rb
41
43
  has_rdoc: false
42
44
  homepage: http://codeforpeople.com/lib/ruby/configuration/
43
45
  post_install_message: