render-text-helper 0.1.0 → 0.2.0

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: 9fa3bf802a34b87ba97a5adde26041af9da76aa1897a6cb671e5d3f854e87bb7
4
- data.tar.gz: 7e3acb894a0defcfb02e07bb8eb16b4c1b1ebabe2374f4f147c5b7f15f9f1b71
3
+ metadata.gz: cdefeb74f5cc8c0757071203881ea156d45e126c5006c04afbd02233d2aa6196
4
+ data.tar.gz: 82aba1c3a82dfcbe9f1179a091a674243da9e255f7ebd5500eee919faec6a4c5
5
5
  SHA512:
6
- metadata.gz: 90167a134c6dab5ee393ddffd1e9e2833b40692d54c733572c47b2edd2c6a796ba6a978c58aec2282370a1afeb88cf28eeda4fbc30578e7a33df133c58566877
7
- data.tar.gz: 66291f7ae3b137077a43b84836e8bbcfc608bed12ba2ab6152daadb6842d4058fea352bdac6d54dd49b25fa29a9311a7b9a7e9d07e88b4dce0932885129de8d5
6
+ metadata.gz: f2864cad96f2ad569c8ddf5938f03407701393881f1927aabe6bca4121d2d0700482031543e2fff8fa619b56d6d3806503d6c5f77daf46e79f8e35be70399172
7
+ data.tar.gz: 8edeb432377b5395aa56298f152298f423595bbc53061673211442a8bd12c24224035b80ede4b6abcbcac7fc67969e4183ac516ea2ef791c0bb6481e3ec15453
data/.rubocop.yml CHANGED
@@ -11,3 +11,10 @@ Style/StringLiteralsInInterpolation:
11
11
 
12
12
  Layout/LineLength:
13
13
  Max: 120
14
+
15
+ Metrics/BlockLength:
16
+ Max: 50
17
+
18
+ Layout/CaseIndentation:
19
+ EnforcedStyle: end
20
+ IndentOneStep: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Changelog
2
2
 
3
+ ## [0.2.0] - 2022-08-17
4
+
5
+ - to_yes_no function can now handle diffident casing
6
+
3
7
  ## [0.1.0] - 2022-08-14
4
8
 
5
9
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- render-text-helper (0.1.0)
4
+ render-text-helper (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -37,19 +37,21 @@ defaults to "."
37
37
  ### to yes no
38
38
 
39
39
  This function returns a string from a boolean to yes or no.
40
+ It takes in optional casting parameter which can be either capitalize, upcase, or downcase.
40
41
 
41
42
  ```ruby
42
43
  true.to_yes_no
43
- 'yes'
44
+ 'Yes'
44
45
 
45
- true.to_yes_no(capital_letter: true)
46
+ true.to_yes_no(:upcase)
46
47
  'YES'
47
48
 
48
- false.to_yes_no
49
+ false.to_yes_no(:downcase)
49
50
  'no'
50
51
 
51
- false.to_yes_no(capital_letter: true)
52
- 'NO'
52
+ false.to_yes_no
53
+ false.to_yes_no(:capitalize)
54
+ 'No'
53
55
  ```
54
56
 
55
57
  ### to yn
@@ -10,11 +10,12 @@ module BooleanHelper
10
10
  end
11
11
  end
12
12
 
13
- def to_yes_no(capital_letter: false)
13
+ # casting: capitalize | upcase | downcase
14
+ def to_yes_no(casting = :capitalize)
14
15
  if self
15
- capital_letter ? 'YES' : 'yes'
16
+ 'yes'.send(casting.to_sym)
16
17
  else
17
- capital_letter ? 'NO' : 'no'
18
+ 'no'.send(casting.to_sym)
18
19
  end
19
20
  end
20
21
  end
@@ -3,7 +3,7 @@
3
3
  module Render
4
4
  module Text
5
5
  module Helper
6
- VERSION = '0.1.0'
6
+ VERSION = '0.2.0'
7
7
  end
8
8
  end
9
9
  end
@@ -20,8 +20,6 @@ Gem::Specification.new do |spec|
20
20
  spec.metadata['source_code_uri'] = 'https://github.com/SaimonL/render-text-helper'
21
21
  spec.metadata['changelog_uri'] = 'https://github.com/SaimonL/render-text-helper/blob/master/CHANGELOG.md'
22
22
 
23
- # Specify which files should be added to the gem when it is released.
24
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
23
  spec.files = Dir.chdir(__dir__) do
26
24
  `git ls-files -z`.split("\x0").reject do |f|
27
25
  (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
@@ -30,10 +28,4 @@ Gem::Specification.new do |spec|
30
28
  spec.bindir = 'exe'
31
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
30
  spec.require_paths = ['lib']
33
-
34
- # Uncomment to register a new dependency of your gem
35
- # spec.add_dependency "example-gem", "~> 1.0"
36
-
37
- # For more information and examples about making a new gem, check out our
38
- # guide at: https://bundler.io/guides/creating_gem.html
39
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render-text-helper
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
  - Saimon Lovell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-15 00:00:00.000000000 Z
11
+ date: 2022-08-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Limit the render text, convert boolean to text etc
14
14
  email: