demisyn 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE.txt +21 -0
- data/README.md +60 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/demisyn.gemspec +25 -0
- data/lib/demisyn/version.rb +3 -0
- data/lib/demisyn.rb +36 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3763a9c08e0ca406f4f848fceb8e944cfe21331a
|
4
|
+
data.tar.gz: 844558ecbd22bbdad8fdc9dcfbdb2ed1f9d83676
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f9be32048ac3161b9cfcbf586144374c0fc2f10542fa47a8da6e3b7d80a0d34f1934bf5083301f36d1348248fc57dc47eacee925fdd4773263c5fd4044e96f73
|
7
|
+
data.tar.gz: 979af0eb2cf235edd061c2ce3372cfa380f729978ce6329ed01253711153ad98d5ecfdab9a73c27c58948a9785e3ba8046273549e6fe20ea9e1e0ae19dca89d8
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Daniel P. Clark
|
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,60 @@
|
|
1
|
+
# Demisyn
|
2
|
+
|
3
|
+
With demisyn you'll never need to dot your methods again. *wink* *wink*
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'demisyn'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install demisyn
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Anywhere you want to use this you must first include this in the scope of its use.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
using Demisyn
|
27
|
+
```
|
28
|
+
|
29
|
+
Then you can evaluate strings and arrays of strings as if they were consecutive methods.
|
30
|
+
Returns `nil` if it fails.
|
31
|
+
|
32
|
+
Examples:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
~"'asdf' reverse split('s') join capitalize"
|
36
|
+
# => "Fda"
|
37
|
+
~%w['asdf' reverse split('s') join capitalize]
|
38
|
+
# => "Fda"
|
39
|
+
~"'asdf' pikachu split('s') join capitalize"
|
40
|
+
# => nil
|
41
|
+
~%w['asdf' pikachu split('s') join capitalize]
|
42
|
+
# => nil
|
43
|
+
```
|
44
|
+
|
45
|
+
This is not ideal if nil is a valid value you expected returned. Think of it as similar
|
46
|
+
to the safe navigation usage.
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/danielpclark/demisyn. This project is intended to be a safe, welcoming space for collaboration.
|
51
|
+
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
Licensed under either of
|
56
|
+
|
57
|
+
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
58
|
+
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
59
|
+
|
60
|
+
at your option.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "demisyn"
|
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
data/demisyn.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'demisyn/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "demisyn"
|
8
|
+
spec.version = Demisyn::VERSION
|
9
|
+
spec.authors = ["Daniel P. Clark"]
|
10
|
+
spec.email = ["6ftdan@gmail.com"]
|
11
|
+
spec.summary = %q{demisyn; it's your escape from method punctuation.}
|
12
|
+
spec.description = %q{demisyn; methods without punctuation. Refinement for punctuationless eval.}
|
13
|
+
spec.homepage = "https://github.com/danielpclark/demisyn"
|
14
|
+
spec.licenses = ["MIT", "Apache-2.0"]
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.5"
|
22
|
+
spec.add_development_dependency "minitest", "~> 5.8"
|
23
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.1"
|
24
|
+
spec.add_development_dependency "color_pound_spec_reporter", "~> 0.0.5"
|
25
|
+
end
|
data/lib/demisyn.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require "demisyn/version"
|
2
|
+
|
3
|
+
module Demisyn
|
4
|
+
class << self
|
5
|
+
def lonely_operator?
|
6
|
+
major, minor, _ = RUBY_VERSION.split('.')
|
7
|
+
major.to_i.>=(2) && minor.to_i.>=(3)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
refine String do
|
12
|
+
case Demisyn.send :lonely_operator?
|
13
|
+
when true
|
14
|
+
def ~()
|
15
|
+
eval gsub(/ /, "&.")
|
16
|
+
end
|
17
|
+
when false
|
18
|
+
def ~()
|
19
|
+
eval gsub(/ /, ".") rescue nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
refine Array do
|
25
|
+
case Demisyn.send :lonely_operator?
|
26
|
+
when true
|
27
|
+
def ~()
|
28
|
+
eval join("&.")
|
29
|
+
end
|
30
|
+
when false
|
31
|
+
def ~()
|
32
|
+
eval join(".") rescue nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: demisyn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel P. Clark
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-13 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.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
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.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-reporters
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: color_pound_spec_reporter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.0.5
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.0.5
|
83
|
+
description: demisyn; methods without punctuation. Refinement for punctuationless
|
84
|
+
eval.
|
85
|
+
email:
|
86
|
+
- 6ftdan@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- MIT-LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/console
|
98
|
+
- bin/setup
|
99
|
+
- demisyn.gemspec
|
100
|
+
- lib/demisyn.rb
|
101
|
+
- lib/demisyn/version.rb
|
102
|
+
homepage: https://github.com/danielpclark/demisyn
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
- Apache-2.0
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.5.0
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: demisyn; it's your escape from method punctuation.
|
127
|
+
test_files: []
|