fat_core 5.6.0 → 5.6.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5da3617fdd85e32caebab66239f6aad376c610b3ac48c57fbe2c09ccddabe408
4
- data.tar.gz: f1390e8cd9325ba3bc0714af566ad4071bc66ec7d41eb0d93beca01c7260fb55
3
+ metadata.gz: e6cdea468a6e0d1208469b2d079d89694e3f70d62f8c9805e8f7372677430127
4
+ data.tar.gz: bb58238999c2d549e834f28a7dc300be835dbf3b3ef722c92f57480c0c426dd5
5
5
  SHA512:
6
- metadata.gz: 76b7de64af3d0110838a4a2e4546ceca681c0ef7fadb9cb161a10e359e65d43c39d3ddd36e8b4528323cfe3338991871af4d42d7cf1dd7d915cf5ee3a8bc5208
7
- data.tar.gz: f5bdf876c503580ddd19049759a5aa388478695e120b099e22c5a687178e9fc25acb960bcf2e5d59b2a82b00a1cb748fd1155cbada8fca99ff64312d87305a77
6
+ metadata.gz: 685e201065051cf82122aa799e2f08fb5ea44c6e5cccf3a454dd3389dfbb2af8cdf4b0bcffbc5d1e68571af8c9e96328d7272a9eb16ffd14194bd6a2f9a45150
7
+ data.tar.gz: 50c4b04bfb61fd22005add98c38a8cd0b29a8d67a479512dbc08f3c34f35669fbc93d8958a89fc3c8f2807c17935e3a451d4ad9755e0dbfb7cfd30568596c321
@@ -16,13 +16,15 @@ module FatCore
16
16
  to_s.tr('_', ' ').split.join(' ').entitle
17
17
  end
18
18
 
19
- # Return self. This (together with String#as_sym) allows `#as_sym` to be
20
- # applied to a string or Symbol and get back a Symbol with out testing for
21
- # type.
19
+ # Return self in a form suitable as an identifier. Ruby allows symbols to
20
+ # have arbitrary characters in them that are not permitted as an
21
+ # identifier. Convert this symbol to one that is a legal identifier. This
22
+ # (together with String#as_sym) allows `#as_sym` to be applied to a string
23
+ # or Symbol and get back a Symbol with out testing for type.
22
24
  #
23
25
  # @return [Symbol] just self
24
26
  def as_sym
25
- self
27
+ as_str.as_sym
26
28
  end
27
29
 
28
30
  # Convert this symbol to a string in such a manner that for simple cases,
@@ -31,6 +33,7 @@ module FatCore
31
33
  to_s
32
34
  .downcase
33
35
  .tr('_', '-')
36
+ .gsub(/\s+/, '_')
34
37
  .gsub(/[^-_A-Za-z0-9]/, '')
35
38
  end
36
39
 
@@ -3,7 +3,7 @@
3
3
  module FatCore
4
4
  MAJOR = 5
5
5
  MINOR = 6
6
- PATCH = 0
6
+ PATCH = 1
7
7
 
8
8
  # FatCore version number
9
9
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
@@ -196,6 +196,7 @@ the people, for the people, shall not perish from the earth."
196
196
  expect('jack_in-the-box'.as_sym).to eq :jack_in_the_box
197
197
  expect('jack_in_the_box'.as_sym).to eq :jack_in_the_box
198
198
  expect('Jack in the Box'.as_sym).to eq :jack_in_the_box
199
+ expect("Four Score \t\n and 7 years ago".as_sym).to eq :four_score_and_7_years_ago
199
200
  end
200
201
 
201
202
  it 'does nothing in response to as_str' do
@@ -11,13 +11,18 @@ describe Symbol do
11
11
  expect(:i_am_a_symbol.tex_quote).to eq 'i\\_am\\_a\\_symbol'
12
12
  end
13
13
 
14
- it 'responds to :as_sym as identity' do
14
+ it 'return self :as_sym as a symbol but also a legal identifier' do
15
15
  expect(:i_am_a_symbol.as_sym).to eq :i_am_a_symbol
16
+ expect(:'i-am-a_symbol'.as_sym).to eq :i_am_a_symbol
17
+ expect(:'Four Score and 7 years ago'.as_sym).to eq :four_score_and_7_years_ago
18
+ expect(:four_score_and_7_years_ago.as_sym).to eq :four_score_and_7_years_ago
16
19
  end
17
20
 
18
21
  it 'as_str is the inverse of as_sym for simple cases' do
19
22
  expect('jack-in-the-box'.as_sym.as_str).to eq 'jack-in-the-box'
20
23
  expect('jack_in-the-box'.as_sym.as_str).to eq 'jack-in-the-box'
21
24
  expect('jack_in-the-box'.as_sym.as_str).to eq 'jack-in-the-box'
25
+ expect(:four_score_and_7_years_ago.as_str).to eq 'four-score-and-7-years-ago'
26
+ expect(:four_score_and_7_years_ago.as_str.as_sym).to eq :four_score_and_7_years_ago
22
27
  end
23
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.0
4
+ version: 5.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty