to-s 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 68d6976020186aaa763701385acb7ed3c8452afe
4
+ data.tar.gz: 385fbfcfe05ab40bc15bf61664a47a30aaa8ee27
5
+ SHA512:
6
+ metadata.gz: f5aa9c0ba31486bd491de00c2ba5745d6a51634d25675ea0de309d4cf6258c03ab17c85b933568911c92b77bfb4f30e975528679520b58693e81d9f3b8f67673
7
+ data.tar.gz: e4f29b321062a5b4313630bc21d4165ebfcf4f39c99d6eda8d1c58f74aa9278481f061724800991e133d50be202a48b92a8d04049cd16f18ddb3367ba5a8f8fb
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem "bundler", "~> 1.7"
6
+ gem "rake", "~> 10.0"
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Genadi Samokovarov
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,17 @@
1
+ Have you ever tried to type `to_s` fast?
2
+
3
+ ```ruby
4
+ >> buffer << input.to-s
5
+ NoMethodError: undefined method `to' for #<Object:0x007f92c5059650>
6
+ ```
7
+
8
+ Bummer, right?
9
+
10
+ ```
11
+ require 'to/s'
12
+
13
+ buffer << input.to-s
14
+ => "#<Object:0x007fb2c9e566d0>"
15
+ ```
16
+
17
+ You are welcome!
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1 @@
1
+ require 'to/s'
@@ -0,0 +1,30 @@
1
+ class To < Struct.new(:target)
2
+ S = Object.new
3
+
4
+ def -(other)
5
+ target.to_s if other == S
6
+ end
7
+ end
8
+
9
+ module Kernel
10
+ def to
11
+ To.new(self)
12
+ end
13
+
14
+ def s
15
+ To::S
16
+ end
17
+ end
18
+
19
+ begin
20
+ # You don't really need Active Support's #to extension of String, do you?
21
+ require 'active_support/core_ext/string/access'
22
+
23
+ class String
24
+ def to
25
+ To.new(self)
26
+ end
27
+ end
28
+ rescue LoadError
29
+ # We tried. :-)
30
+ end
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "to-s"
7
+ spec.version = '0.1.0'
8
+ spec.authors = ["Genadi Samokovarov"]
9
+ spec.email = ["gsamokovarov@gmail.com"]
10
+ spec.summary = "Write to_s fast."
11
+ spec.summary = "Write to_s fast."
12
+ spec.homepage = "https://github.com/gsamokovarov/to-s"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: to-s
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Genadi Samokovarov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - gsamokovarov@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - LICENSE.txt
23
+ - README.md
24
+ - Rakefile
25
+ - lib/to-s.rb
26
+ - lib/to/s.rb
27
+ - to-s.gemspec
28
+ homepage: https://github.com/gsamokovarov/to-s
29
+ licenses:
30
+ - MIT
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project:
48
+ rubygems_version: 2.4.5
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: Write to_s fast.
52
+ test_files: []