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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3763a9c08e0ca406f4f848fceb8e944cfe21331a
4
- data.tar.gz: 844558ecbd22bbdad8fdc9dcfbdb2ed1f9d83676
3
+ metadata.gz: 48c94c000738397a81cf1867746648041d79ffe2
4
+ data.tar.gz: 4bb1422947be8b5a09e68d46b176b0776634ff32
5
5
  SHA512:
6
- metadata.gz: f9be32048ac3161b9cfcbf586144374c0fc2f10542fa47a8da6e3b7d80a0d34f1934bf5083301f36d1348248fc57dc47eacee925fdd4773263c5fd4044e96f73
7
- data.tar.gz: 979af0eb2cf235edd061c2ce3372cfa380f729978ce6329ed01253711153ad98d5ecfdab9a73c27c58948a9785e3ba8046273549e6fe20ea9e1e0ae19dca89d8
6
+ metadata.gz: 426583fbd200d426c7c23bf007aad8760029c581e74ddf15ee69f1799bd68de3db258fb35030d51a427ac023ec41487c28e3960464be9a4e63ee75110e1f4f8e
7
+ data.tar.gz: 73ec5f187c533459863522cbb7822ee6c2d6d1275e566834dfa87d734ca3cd222d17bbfe0d3fbfc5d4e80e472da7193ea20a1c0152bbeb9683f00a0ef1b8b749
data/.gitignore CHANGED
@@ -7,3 +7,5 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.swp
11
+ *.gem
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.3
3
+ - 2.2.4
4
+ - 2.3.0
4
5
  before_install: gem install bundler -v 1.11.0
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 in the scope of its use.
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
- # => nil
42
+ #NoMethodError: undefined method
41
43
  ~%w['asdf' pikachu split('s') join capitalize]
42
- # => nil
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
- This is not ideal if nil is a valid value you expected returned. Think of it as similar
46
- to the safe navigation usage.
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
- when false
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
@@ -1,3 +1,3 @@
1
1
  module Demisyn
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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.0
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.