dslh 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34fdaa1328cc3db25ed56fd20cd760d792a69522
4
- data.tar.gz: 082e32708c7439a9ae026cc017103b1512a924c7
3
+ metadata.gz: 03bc40c96b4543fc6f64a2c59c7d5232d774e2d8
4
+ data.tar.gz: 7de70d4ee2eea8fbf6a3a98c06065b6dbca8c8c6
5
5
  SHA512:
6
- metadata.gz: 1d87263bf3c762a927b97d88516ed5de18ff03eedca6fa7bf6655990a9045e3bce11eed6b87952e470519d68c2af794df2875bed3a38e650f7a90cff2a01bfd0
7
- data.tar.gz: b92baf05a6cfe51663bc39a6894c13b6ed545ed1eeabe14724fd0829fd1a0302b484c7daefed7456f9826c46c4271ff2f459cf048d1fc0ecc7de4084b7d045ae
6
+ metadata.gz: ae912dc62430f939a902962a34e81ded1d847b2915de51d169bc0413bb60ac48ddb7d975b3f35431a30df3b9f78f9ee6d9761a3aabb1af9af84da75b299eee1a
7
+ data.tar.gz: 48b171525b578a2228e0068fa29b77bf6af71570b85231688923b38f4e9e8777b041156ff530f438be8afa21450b5fdd0e05f21addc79b14274d802bde89fb98
@@ -0,0 +1,12 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.0.0
6
+ - 2.1.8
7
+ - 2.2.4
8
+ - 2.3.0
9
+ before_install:
10
+ - gem install bundler
11
+ script:
12
+ - bundle exec rake
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  It define Hash as a DSL.
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/dslh.png?201403151541)](http://badge.fury.io/rb/dslh)
6
- [![Build Status](https://drone.io/github.com/winebarrel/dslh/status.png?201403151541)](https://drone.io/github.com/winebarrel/dslh/latest)
5
+ [![Gem Version](https://badge.fury.io/rb/dslh.svg)](https://badge.fury.io/rb/dslh)
6
+ [![Build Status](https://travis-ci.org/winebarrel/dslh.svg?branch=master)](https://travis-ci.org/winebarrel/dslh)
7
7
 
8
8
  ## Installation
9
9
 
@@ -102,32 +102,25 @@ h = {"glossary"=>
102
102
  "GlossSeeAlso"=>["GML", "XML"]},
103
103
  "GlossSee"=>"markup"}}}}}
104
104
 
105
- puts Dslh.deval(h) # => glossary do
106
- # title "example glossary"
107
- # GlossDiv do
108
- # title "S"
109
- # GlossList do
110
- # GlossEntry do
111
- # ID "SGML"
112
- # SortAs "SGML"
113
- # GlossTerm "Standard Generalized Markup Language"
114
- # Acronym "SGML"
115
- # Abbrev "ISO 8879:1986"
116
- # GlossDef do
117
- # para "A meta-markup language, used to create markup languages such as DocBook."
118
- # GlossSeeAlso "GML", "XML"
119
- # end
120
- # GlossSee "markup"
121
- # end
122
- # end
123
- # end
124
- # end
105
+ puts Dslh.deval(h)
106
+ # => glossary do
107
+ # title "example glossary"
108
+ # GlossDiv do
109
+ # title "S"
110
+ # GlossList do
111
+ # GlossEntry do
112
+ # ID "SGML"
113
+ # SortAs "SGML"
114
+ # GlossTerm "Standard Generalized Markup Language"
115
+ # Acronym "SGML"
116
+ # Abbrev "ISO 8879:1986"
117
+ # GlossDef do
118
+ # para "A meta-markup language, used to create markup languages such as DocBook."
119
+ # GlossSeeAlso "GML", "XML"
120
+ # end
121
+ # GlossSee "markup"
122
+ # end
123
+ # end
124
+ # end
125
+ # end
125
126
  ```
126
-
127
- ## Contributing
128
-
129
- 1. Fork it ( http://github.com/<my-github-username>/dslh/fork )
130
- 2. Create your feature branch (`git checkout -b my-new-feature`)
131
- 3. Commit your changes (`git commit -am 'Add some feature'`)
132
- 4. Push to the branch (`git push origin my-new-feature`)
133
- 5. Create new Pull Request
@@ -20,5 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler'
22
22
  spec.add_development_dependency 'rake'
23
- spec.add_development_dependency 'rspec', '>= 2.11.0'
23
+ spec.add_development_dependency 'rspec', '>= 3.0.0'
24
24
  end
@@ -50,6 +50,18 @@ class Dslh
50
50
  scope.instance_variable_set(:@__hash__, retval)
51
51
  @options[:scope_hook].call(scope) if @options[:scope_hook]
52
52
 
53
+ if @options[:ignore_methods]
54
+ ignore_methods = Array(@options[:ignore_methods])
55
+
56
+ ignore_methods.each do |method_name|
57
+ scope.instance_eval(<<-EOS)
58
+ def #{method_name}(*args, &block)
59
+ method_missing(#{method_name.to_s.inspect}, *args, &block)
60
+ end
61
+ EOS
62
+ end
63
+ end
64
+
53
65
  if expr
54
66
  eval_args = [expr]
55
67
 
@@ -1,3 +1,3 @@
1
1
  class Dslh
2
- VERSION = '0.2.7'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -2500,4 +2500,34 @@ glossary do
2500
2500
  end
2501
2501
  EOS
2502
2502
  end
2503
+
2504
+ it 'include "system()"' do
2505
+ h = Dslh.eval(:ignore_methods => [:system]) do
2506
+ system do
2507
+ key1 'value'
2508
+ key2 100
2509
+
2510
+ key3(
2511
+ 100 => 200,
2512
+ 'XXX' => :XXX
2513
+ )
2514
+
2515
+ key4 do
2516
+ system(
2517
+ '300' => '400',
2518
+ :FOO => :BAR
2519
+ )
2520
+ key42 100
2521
+ end
2522
+ end
2523
+ end
2524
+
2525
+ expect(h).to eq(
2526
+ {"system"=>
2527
+ {:key1=>"value",
2528
+ :key2=>100,
2529
+ :key3=>{100=>200, "XXX"=>:XXX},
2530
+ :key4=>{"system"=>{"300"=>"400", :FOO=>:BAR}, :key42=>100}}}
2531
+ )
2532
+ end
2503
2533
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dslh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-15 00:00:00.000000000 Z
11
+ date: 2016-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.11.0
47
+ version: 3.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 2.11.0
54
+ version: 3.0.0
55
55
  description: It define Hash as a DSL.
56
56
  email:
57
57
  - sugawara@cookpad.com
@@ -59,8 +59,9 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
63
- - .rspec
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
64
65
  - Gemfile
65
66
  - LICENSE.txt
66
67
  - README.md
@@ -82,17 +83,17 @@ require_paths:
82
83
  - lib
83
84
  required_ruby_version: !ruby/object:Gem::Requirement
84
85
  requirements:
85
- - - '>='
86
+ - - ">="
86
87
  - !ruby/object:Gem::Version
87
88
  version: '0'
88
89
  required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements:
90
- - - '>='
91
+ - - ">="
91
92
  - !ruby/object:Gem::Version
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project:
95
- rubygems_version: 2.0.14
96
+ rubygems_version: 2.4.5.1
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: It define Hash as a DSL.