instant_dsl 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -5
- data/VERSION +1 -1
- data/instant_dsl.gemspec +1 -1
- data/lib/instant_dsl.rb +10 -4
- metadata +3 -3
data/README
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/instant_dsl.gemspec
CHANGED
data/lib/instant_dsl.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
|
2
2
|
module InstantDSL
|
3
|
-
def self.
|
4
|
-
|
3
|
+
def self.new(*actions)
|
4
|
+
mod = Module.new
|
5
5
|
|
6
|
-
|
6
|
+
mod.send :attr_accessor, :dsl_values
|
7
7
|
|
8
8
|
actions.each do |act|
|
9
|
-
|
9
|
+
mod.send :define_method, act do |*args|
|
10
10
|
@dsl_values ||= {}
|
11
11
|
@dsl_values[act] ||= []
|
12
12
|
@dsl_values[act] += args
|
13
13
|
self
|
14
14
|
end
|
15
15
|
end
|
16
|
+
mod
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.[](*actions)
|
20
|
+
kls = Class.new
|
21
|
+
kls.send :include, self.new(*actions)
|
16
22
|
kls
|
17
23
|
end
|
18
24
|
end
|