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 +4 -4
- data/.travis.yml +12 -0
- data/README.md +23 -30
- data/dslh.gemspec +1 -1
- data/lib/dslh.rb +12 -0
- data/lib/dslh/version.rb +1 -1
- data/spec/dslh_spec.rb +30 -0
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03bc40c96b4543fc6f64a2c59c7d5232d774e2d8
|
4
|
+
data.tar.gz: 7de70d4ee2eea8fbf6a3a98c06065b6dbca8c8c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae912dc62430f939a902962a34e81ded1d847b2915de51d169bc0413bb60ac48ddb7d975b3f35431a30df3b9f78f9ee6d9761a3aabb1af9af84da75b299eee1a
|
7
|
+
data.tar.gz: 48b171525b578a2228e0068fa29b77bf6af71570b85231688923b38f4e9e8777b041156ff530f438be8afa21450b5fdd0e05f21addc79b14274d802bde89fb98
|
data/.travis.yml
ADDED
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.
|
6
|
-
[![Build Status](https://
|
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)
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
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
|
data/dslh.gemspec
CHANGED
data/lib/dslh.rb
CHANGED
@@ -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
|
|
data/lib/dslh/version.rb
CHANGED
data/spec/dslh_spec.rb
CHANGED
@@ -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.
|
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:
|
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:
|
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:
|
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.
|
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.
|