daberu 0.0.2

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in daberu.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 myokoym
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # Daberu
2
+
3
+ おしゃべりなオブジェクトをつくることができます。
4
+ [You can create a talkative object.]
5
+
6
+ 主な用途:デバッグ
7
+ [One way, Debugging.]
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'daberu'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install daberu
22
+
23
+ ## Usage
24
+
25
+ require 'daberu'
26
+
27
+ a = Daberu.new([])
28
+ a << 1 #=> "Method: <<, Arguments: [1], Block: "
29
+ a << 2 #=> "Method: <<, Arguments: [2], Block: "
30
+ a << 3 #=> "Method: <<, Arguments: [3], Block: "
31
+ a.each do |i|
32
+ p i
33
+ end
34
+ #=> "Method: each, Arguments: [], Block: #<Proc:...>"
35
+ 1
36
+ 2
37
+ 3
38
+
39
+ ## Contributing
40
+
41
+ 1. Fork it
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/daberu/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["myokoym"]
6
+ gem.email = ["myokoym@gmail.com"]
7
+ gem.description = %q{Create a talkative object.}
8
+ gem.summary = %q{Create a talkative object}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "daberu"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Daberu::VERSION
17
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ class Daberu
4
+ instance_methods.each do |m|
5
+ undef_method m unless m.to_s =~ /^__|method_missing|respond_to?|object_id/
6
+ end
7
+
8
+ def initialize(obj = Object.new)
9
+ @obj = obj
10
+ end
11
+
12
+ def method_missing(name, *args, &block)
13
+ p "Method: #{name}, Arguments: #{args}, Block: #{block}"
14
+ @obj.send(name, *args, &block)
15
+ end
16
+ end
17
+
@@ -0,0 +1,3 @@
1
+ module Daberu
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,63 @@
1
+ # encoding: utf-8
2
+
3
+ require 'daberu'
4
+ require 'tempfile'
5
+
6
+ describe Daberu do
7
+ it "is no argument" do
8
+ t = Tempfile.open("daberu")
9
+ $stdout = File.open(t, "w")
10
+ d = Daberu.new
11
+ d.class.should == Object
12
+ $stdout.flush
13
+ $stdout = STDOUT
14
+ end
15
+
16
+ it "is Array object" do
17
+ t = Tempfile.open("daberu")
18
+ $stdout = File.open(t, "w")
19
+ a = Daberu.new([])
20
+ a << "a"
21
+ a << "b"
22
+ a << "c"
23
+ actual = []
24
+ a.each do |i|
25
+ actual << i
26
+ end
27
+ $stdout.flush
28
+ $stdout = STDOUT
29
+ actual.should == %w[a b c]
30
+ end
31
+
32
+ it "is stdout" do
33
+ t = Tempfile.open("daberu")
34
+ $stdout = File.open(t, "w")
35
+ a = Daberu.new([])
36
+ a << "a"
37
+ actual = []
38
+ a.each do |i|
39
+ actual << i
40
+ end
41
+ $stdout.flush
42
+ $stdout = STDOUT
43
+ File.open(t) {|f|
44
+ lines = f.read.split(/\n/)
45
+ lines[0].should =~ /Method: <<, Arguments: \[(\\)*"a(\\)*"\], Block: /
46
+ lines[1].should =~ /Method: each, Arguments: \[\], Block: #<Proc:/
47
+ }
48
+ end
49
+
50
+ it "is stdout of no argument" do
51
+ t = Tempfile.open("daberu")
52
+ $stdout = File.open(t, "w")
53
+ d = Daberu.new
54
+ d.class
55
+ $stdout.flush
56
+ $stdout = STDOUT
57
+ File.open(t) {|f|
58
+ lines = f.read.split(/\n/)
59
+ lines[0].should =~ /Method: class, Arguments: \[\], Block: /
60
+ }
61
+ end
62
+ end
63
+
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: daberu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - myokoym
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-01 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Create a talkative object.
15
+ email:
16
+ - myokoym@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE
24
+ - README.md
25
+ - Rakefile
26
+ - daberu.gemspec
27
+ - lib/daberu.rb
28
+ - lib/daberu/version.rb
29
+ - spec/daberu_spec.rb
30
+ homepage: ''
31
+ licenses: []
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 1.8.23
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Create a talkative object
54
+ test_files:
55
+ - spec/daberu_spec.rb
56
+ has_rdoc: