kasen 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1c2091083a33b7cbb099c9ee0b6446cfbcee813c
4
+ data.tar.gz: 617724d273b7cfdd320a97e91dbc4f5c1efb8e08
5
+ SHA512:
6
+ metadata.gz: 683f4ce846a8d044a1c9d63818a0ff0e6f65b17ab92e6861329ac75d56ff133504a3a9a700890df49a3790aa9e2b2cb49183d07f0561518a1d1358b8d824420e
7
+ data.tar.gz: 7142cd10f757a4b9e8bc90c758b7d83e84904d135f84d305aea99dd9b78f89a0afa0ab18cc3d2695e73182ff0634743ecb316f20d363b03e5cba321e027882a4
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/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache:
4
+ - bundler
5
+
6
+ bundler:
7
+ rvm:
8
+ - 2.2
9
+ - 2.1
10
+ - 2.0
11
+ - ruby-head
12
+ - jruby-head
13
+ - rbx-2
14
+
15
+ notifications:
16
+ email: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## CHANGELOG
2
+
3
+ ### 0.1.0
4
+
5
+ * Inital release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kasen.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Kasen
2
+
3
+ ![kasen.png](https://qiita-image-store.s3.amazonaws.com/0/30440/7ac5c816-ad6d-dd62-1783-a2c435455fde.png)
4
+
5
+ 下線(Kasen) ... Underscore.
6
+
7
+ ```ruby
8
+ require 'kasen'
9
+ [[1, 2], [3, 4]].map &_[1]
10
+ # is equivalent for
11
+ [[1, 2], [3, 4]].map { |ary| ary[1] }
12
+
13
+ ['0', '1', '2'].select &_.to_i.zero?
14
+ # is equivalent for
15
+ ['0', '1', '2'].select { |s| s.to_i.zero? },
16
+
17
+ [['1', '2'], ['3', '4']].map { |ary| ary.select { |n| n.to_i.eql?(1) } },
18
+ # is equivalent for
19
+ [['1', '2'], ['3', '4']].map(&_.select(&_.to_i.eql?(1)))
20
+ ```
21
+
22
+ note: you can use `k` instead of `_` in IRB.
23
+
24
+ ## Installation
25
+
26
+ Add this line to your application's Gemfile:
27
+
28
+ ```ruby
29
+ gem 'kasen'
30
+ ```
31
+
32
+ And then execute:
33
+
34
+ $ bundle
35
+
36
+ Or install it yourself as:
37
+
38
+ $ gem install kasen
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
43
+
44
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
+
46
+ ## License
47
+
48
+ MIT license (© 2015 Kazuki Tanaka)
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ end
7
+
8
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "kasen"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/kasen.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kasen/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "kasen"
8
+ spec.version = Kasen::VERSION
9
+ spec.authors = ["gogotanaka"]
10
+ spec.email = ["mail@tanakakazuki.com"]
11
+
12
+ spec.summary = %q{ Scala like underscore for block. }
13
+
14
+ spec.description = %q{ Scala like underscore for block. }
15
+ spec.homepage = "https://github.com/gogotanaka/kasen"
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
+
22
+ # if spec.respond_to?(:metadata)
23
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
24
+ # end
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.9"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "minitest"
29
+ end
data/lib/kasen.rb ADDED
@@ -0,0 +1,39 @@
1
+ require "kasen/version"
2
+
3
+ module Kernel
4
+ def k
5
+ Kasen.new
6
+ end
7
+ alias _ k
8
+ end
9
+
10
+ class Kasen
11
+ # Disable all build-in methods
12
+ verbose, $VERBOSE = $VERBOSE, nil
13
+ begin
14
+ instance_methods(true).each { |meth| undef_method(meth) }
15
+ private_instance_methods(true).each { |meth| undef_method(meth) }
16
+ ensure
17
+ $VERBOSE = verbose
18
+ end
19
+
20
+ def initialize
21
+ @_calling_methods = []
22
+ end
23
+
24
+ def to_proc
25
+ Proc.new { |o|
26
+ @_calling_methods.each do |calling_method|
27
+ o = calling_method.call(o)
28
+ end
29
+ o
30
+ }
31
+ end
32
+
33
+ def method_missing(name, *args, &block)
34
+ @_calling_methods << Proc.new { |o|
35
+ o.send(name, *args, &block)
36
+ }
37
+ self
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ class Kasen
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kasen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - gogotanaka
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: " Scala like underscore for block. "
56
+ email:
57
+ - mail@tanakakazuki.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - CHANGELOG.md
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - kasen.gemspec
71
+ - lib/kasen.rb
72
+ - lib/kasen/version.rb
73
+ homepage: https://github.com/gogotanaka/kasen
74
+ licenses: []
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.4.5
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Scala like underscore for block.
96
+ test_files: []