demisyn 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +2 -1
- data/README.md +20 -7
- data/lib/demisyn.rb +11 -11
- data/lib/demisyn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48c94c000738397a81cf1867746648041d79ffe2
|
4
|
+
data.tar.gz: 4bb1422947be8b5a09e68d46b176b0776634ff32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 426583fbd200d426c7c23bf007aad8760029c581e74ddf15ee69f1799bd68de3db258fb35030d51a427ac023ec41487c28e3960464be9a4e63ee75110e1f4f8e
|
7
|
+
data.tar.gz: 73ec5f187c533459863522cbb7822ee6c2d6d1275e566834dfa87d734ca3cd222d17bbfe0d3fbfc5d4e80e472da7193ea20a1c0152bbeb9683f00a0ef1b8b749
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Demisyn
|
2
|
+
[![Build Status](https://travis-ci.org/danielpclark/demisyn.svg)](https://travis-ci.org/danielpclark/demisyn)
|
2
3
|
|
3
4
|
With demisyn you'll never need to dot your methods again. *wink* *wink*
|
4
5
|
|
@@ -20,30 +21,42 @@ Or install it yourself as:
|
|
20
21
|
|
21
22
|
## Usage
|
22
23
|
|
23
|
-
Anywhere you want to use this you must first include this
|
24
|
+
Anywhere you want to use this (within Objects) you must first include this
|
25
|
+
in the scope of its use.
|
24
26
|
|
25
27
|
```ruby
|
26
28
|
using Demisyn
|
27
29
|
```
|
28
30
|
|
29
31
|
Then you can evaluate strings and arrays of strings as if they were consecutive methods.
|
30
|
-
Returns `nil` if it fails.
|
31
32
|
|
32
|
-
Examples
|
33
|
+
###Examples
|
33
34
|
|
34
35
|
```ruby
|
35
36
|
~"'asdf' reverse split('s') join capitalize"
|
36
37
|
# => "Fda"
|
37
38
|
~%w['asdf' reverse split('s') join capitalize]
|
38
39
|
# => "Fda"
|
40
|
+
|
39
41
|
~"'asdf' pikachu split('s') join capitalize"
|
40
|
-
#
|
42
|
+
#NoMethodError: undefined method
|
41
43
|
~%w['asdf' pikachu split('s') join capitalize]
|
42
|
-
#
|
44
|
+
#NoMethodError: undefined method
|
43
45
|
```
|
46
|
+
Note to execute Demisyn in this fashion you must use the tilde before an Array or String.
|
47
|
+
|
48
|
+
####Ruby 2.3.0
|
49
|
+
|
50
|
+
Since Ruby 2.3.0 has added the safe navigation operator I've made that available for your
|
51
|
+
method chain. Instead of using tilde before a String or Array use the minus symbol.
|
44
52
|
|
45
|
-
|
46
|
-
|
53
|
+
```ruby
|
54
|
+
-"'asdf' reverse split('s') join capitalize"
|
55
|
+
# => "Fda"
|
56
|
+
|
57
|
+
-"'asdf'[7] reverse split('s') join capitalize"
|
58
|
+
# => nil
|
59
|
+
```
|
47
60
|
|
48
61
|
## Contributing
|
49
62
|
|
data/lib/demisyn.rb
CHANGED
@@ -9,28 +9,28 @@ module Demisyn
|
|
9
9
|
end
|
10
10
|
|
11
11
|
refine String do
|
12
|
+
def ~()
|
13
|
+
eval gsub(/ /, ".")
|
14
|
+
end
|
15
|
+
|
12
16
|
case Demisyn.send :lonely_operator?
|
13
17
|
when true
|
14
|
-
def
|
18
|
+
def -@
|
15
19
|
eval gsub(/ /, "&.")
|
16
20
|
end
|
17
|
-
|
18
|
-
def ~()
|
19
|
-
eval gsub(/ /, ".") rescue nil
|
20
|
-
end
|
21
|
-
end
|
21
|
+
end
|
22
22
|
end
|
23
23
|
|
24
24
|
refine Array do
|
25
|
+
def ~()
|
26
|
+
eval join(".")
|
27
|
+
end
|
28
|
+
|
25
29
|
case Demisyn.send :lonely_operator?
|
26
30
|
when true
|
27
|
-
def
|
31
|
+
def -@
|
28
32
|
eval join("&.")
|
29
33
|
end
|
30
|
-
when false
|
31
|
-
def ~()
|
32
|
-
eval join(".") rescue nil
|
33
|
-
end
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/demisyn/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: demisyn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel P. Clark
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.5.
|
123
|
+
rubygems_version: 2.5.1
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: demisyn; it's your escape from method punctuation.
|