embrace 1.2.0 → 1.2.1

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: 2c95bc8f771e08e4ef58fa14e41645a09eda9b45
4
- data.tar.gz: 07e95a03836461446da5297a12c7843d338b1ceb
3
+ metadata.gz: 2151d5d0fb534964eea78de0ca65bc95f8f9d4ef
4
+ data.tar.gz: 6b4e80a69b7c2493c7b3de23a952868886fb7edf
5
5
  SHA512:
6
- metadata.gz: 012075dc5a54d2433ba514ab50ca31a32fee46bbfb699072995276b58c09caf0f4a8db8dafeac8db20cb30b878ff9e340ee624fb8f0e6218a60f98a8054bb077
7
- data.tar.gz: 71464d197802977afd6e15548cbd8ff60c4e7756a7839d3201a949b6709149e830dfa2406e1b6b073014ca00e51197be3a2a10078cc8a5bd8d1c6a9d264fc8aa
6
+ metadata.gz: c908ce4f147a0ba55e1dcc5122a7f2ba521e48f04cb0b72f87b0509069da255358e1d25fe4c5b75b2aa93572f43cbbb986b2edd52202493fe77a42d424605226
7
+ data.tar.gz: 23aa76aa0e5ade03f8a45f12ca4033af50c9ead5788f070eb0d3d8cb577b2f8d63abb27fe6e3997438953f5aa3b7e118c04ab22888dbd0d7dc354d82675ab5fb
@@ -3,15 +3,13 @@ require "embrace"
3
3
  module Embrace
4
4
  class Brackets < Proc
5
5
  class << self
6
- def from_brackets(opening, closing)
7
- new do |text|
8
- "#{opening}#{text}#{closing}"
9
- end
6
+ def new(opening, closing)
7
+ super(&(->(text) { "#{opening}#{text}#{closing}" }))
10
8
  end
11
9
 
12
10
  def from_str(style)
13
11
  i = style.size / 2
14
- from_brackets(style[0...i], style[i..-1])
12
+ new(style[0...i], style[i..-1])
15
13
  end
16
14
  end
17
15
 
@@ -30,14 +28,14 @@ module Embrace
30
28
 
31
29
  module_function
32
30
 
33
- def Brackets(style, *rest)
34
- return Brackets.from_brackets(*[ style, *rest ].map(&:to_s)) unless rest.empty?
31
+ def Brackets(style_or_opening, *closing)
32
+ return Brackets.new(style_or_opening.to_s, *closing.map(&:to_s)) unless closing.empty?
35
33
 
36
- case style
37
- when Brackets then style
38
- when Array then Brackets(*style)
34
+ case style_or_opening
35
+ when Brackets then style_or_opening
36
+ when Array then Brackets(*style_or_opening)
39
37
  else
40
- Brackets.from_str(style.to_s)
38
+ Brackets.from_str(style_or_opening.to_s)
41
39
  end
42
40
  end
43
41
  end
@@ -1,3 +1,3 @@
1
1
  module Embrace
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Carney