modulla 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b454199c694e89f9e385eaace86cf94d23e9e09d
4
+ data.tar.gz: 576bb1e8edfd67fcee2ad2bfcd1688fc305804d1
5
+ SHA512:
6
+ metadata.gz: 3aa59d458012202f40505f89a12526f85c297382b70b44237343ba581f6cb4f6db68e477614eb924d421d4906f6e8fbf679fbd3a744c748d8a814672c7689157
7
+ data.tar.gz: 5e4b5f065d74b6f27af526576d3c2860a83e03035072638a7093f657f032a63a5337a7a214100588ec4d74f32356dd7632313cdcd8626c172883dc61353c78f4
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'test-unit'
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Kunpei Sakai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Modulla
2
+
3
+ Modulla is a super simple gem to enable DSL on your module.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'modulla'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install modulla
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ module DSL
25
+ extend Modulla
26
+
27
+ foo { 'foo' }
28
+ bar { 'bar' }
29
+ baz { 'baz' }
30
+
31
+ plus(1, 1)
32
+ end
33
+
34
+ class Sample
35
+ def self.foo(&block)
36
+ puts block.call * 1
37
+ end
38
+
39
+ def self.bar(&block)
40
+ puts block.call * 2
41
+ end
42
+
43
+ def self.baz(&block)
44
+ puts block.call * 3
45
+ end
46
+
47
+ def self.plus(a, b)
48
+ puts a + b
49
+ end
50
+ end
51
+
52
+ class Sample
53
+ include DSL #=> Output: 'foo', 'barbar', 'bazbazbaz', 2
54
+ end
55
+ ```
56
+
57
+ You can use modulla for use shared_examples in test-unit like this.
58
+
59
+ ```ruby
60
+ module SharedExamplesForFoo
61
+ extend Modulla
62
+
63
+ sub_test_case 'foo' do
64
+ test 'yay' do
65
+ assert { ... }
66
+ end
67
+ end
68
+ end
69
+
70
+ class Testing < Test::Unit::TestCase
71
+ include SharedExamplesForFoo
72
+ end
73
+ ```
74
+
75
+ ## Contributing
76
+
77
+ Bug reports and pull requests are welcome on GitHub at https://github.com/namusyaka/modulla.
78
+
79
+
80
+ ## License
81
+
82
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
83
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,3 @@
1
+ module Modulla
2
+ VERSION = "0.1.0"
3
+ end
data/lib/modulla.rb ADDED
@@ -0,0 +1,25 @@
1
+ require "modulla/version"
2
+
3
+ module Modulla
4
+ def self.new(&block)
5
+ Module.new.extend(self).class_eval(&block)
6
+ end
7
+
8
+ def included(klass)
9
+ reproduce(klass)
10
+ end
11
+
12
+ def reproduce(klass)
13
+ record_keeper.each do |method, args, block|
14
+ klass.send(method, *args, &block)
15
+ end
16
+ end
17
+
18
+ def record_keeper
19
+ @record_keeper ||= []
20
+ end
21
+
22
+ def method_missing(method, *args, &block)
23
+ record_keeper << [method, args, block]
24
+ end
25
+ end
data/modulla.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'modulla/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "modulla"
8
+ spec.version = Modulla::VERSION
9
+ spec.authors = ["namusyaka"]
10
+ spec.email = ["namusyaka@gmail.com"]
11
+
12
+ spec.summary = %q{Enables DSL on your module}
13
+ spec.description = spec.summary
14
+ spec.homepage = "https://github.com/namusyaka/modulla"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: modulla
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - namusyaka
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-11-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Enables DSL on your module
14
+ email:
15
+ - namusyaka@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - ".rspec"
22
+ - ".travis.yml"
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - lib/modulla.rb
28
+ - lib/modulla/version.rb
29
+ - modulla.gemspec
30
+ homepage: https://github.com/namusyaka/modulla
31
+ licenses:
32
+ - MIT
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 2.5.1
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Enables DSL on your module
54
+ test_files: []