instant_dsl 0.1.0 → 0.2.1

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 +10 -14
  2. data/VERSION +1 -1
  3. data/instant_dsl.gemspec +45 -0
  4. data/lib/instant_dsl.rb +1 -1
  5. metadata +3 -2
data/README CHANGED
@@ -9,27 +9,23 @@ Installation:
9
9
 
10
10
  $ gem install instant_dsl
11
11
 
12
+
12
13
  Usage:
13
14
 
14
15
  require 'instant_dsl'
15
16
 
16
- # Let's say we want DSL methods like in this lambda:
17
+ PageDSL = InstantDSL[:title, :items]
18
+
19
+ class Page
20
+ include PageDSL
21
+ end
22
+
23
+ page = Page.new
17
24
 
18
- front_page = lambda do
25
+ page.instance_eval do
19
26
  title 'hey'
20
27
  items 'box', 'bib'
21
28
  items 'bob'
22
29
  end
23
30
 
24
- # One way to implement this is to define a new class
25
- # with the appropriate instance methods, and run any
26
- # DSL code in its instance scope.
27
- # InstantDSL simplifies that:
28
-
29
- PageDSL = InstantDSL[:title, :items] # instantiates new class
30
-
31
- scope = PageDSL.new
32
-
33
- scope.instance_eval( front_page )
34
-
35
- scope.dsl_values # => {:title => ['hey'], :items => ['box', 'bib', 'bob']}
31
+ page.dsl_values # => {:title => ['hey'], :items => ['box', 'bib', 'bob']}
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.1
@@ -0,0 +1,45 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{instant_dsl}
8
+ s.version = "0.2.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["jbe"]
12
+ s.date = %q{2010-12-08}
13
+ s.description = %q{Helps you define new DSL's by manufacturing classes.}
14
+ s.email = %q{post@jostein.be}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "instant_dsl.gemspec",
27
+ "lib/instant_dsl.rb"
28
+ ]
29
+ s.homepage = %q{http://github.com/jbe/instant_dsl}
30
+ s.rdoc_options = ["--charset=UTF-8"]
31
+ s.require_paths = ["lib"]
32
+ s.rubygems_version = %q{1.3.7}
33
+ s.summary = %q{Define new DSL's with ease.}
34
+
35
+ if s.respond_to? :specification_version then
36
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
37
+ s.specification_version = 3
38
+
39
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
40
+ else
41
+ end
42
+ else
43
+ end
44
+ end
45
+
data/lib/instant_dsl.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  module InstantDSL
3
3
  def self.[](*actions)
4
- kls = Class.new
4
+ kls = Module.new
5
5
 
6
6
  kls.send :attr_accessor, :dsl_values
7
7
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 2
7
8
  - 1
8
- - 0
9
- version: 0.1.0
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - jbe
@@ -34,6 +34,7 @@ files:
34
34
  - README
35
35
  - Rakefile
36
36
  - VERSION
37
+ - instant_dsl.gemspec
37
38
  - lib/instant_dsl.rb
38
39
  has_rdoc: true
39
40
  homepage: http://github.com/jbe/instant_dsl