render-text-helper 0.2.0 → 0.3.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: cdefeb74f5cc8c0757071203881ea156d45e126c5006c04afbd02233d2aa6196
4
- data.tar.gz: 82aba1c3a82dfcbe9f1179a091a674243da9e255f7ebd5500eee919faec6a4c5
3
+ metadata.gz: 57f6f2d965d2d588d269be891d4ac6028831ef49af289926636e0a7d7049ae4f
4
+ data.tar.gz: 9066cb97c265e6bfdc1a6c0dc0996ab25f30ed8e47f1bc832e92b3975a745e5e
5
5
  SHA512:
6
- metadata.gz: f2864cad96f2ad569c8ddf5938f03407701393881f1927aabe6bca4121d2d0700482031543e2fff8fa619b56d6d3806503d6c5f77daf46e79f8e35be70399172
7
- data.tar.gz: 8edeb432377b5395aa56298f152298f423595bbc53061673211442a8bd12c24224035b80ede4b6abcbcac7fc67969e4183ac516ea2ef791c0bb6481e3ec15453
6
+ metadata.gz: d1681f1d123faa5263145474f0816509d88b3bb56eac11e4ab5a11706e9c7e1430f315979418ba328f08ba1f8fba48d580beb2f9ce059c0a42dcbb397faac906
7
+ data.tar.gz: '0945518092399597d2050cadcd145ba5f05576ab2a34e02236d1ea04c82087a6284c46ee91898db2b329ae76c28393a64b671e80784a196d56f557b07037ace7'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## Changelog
2
2
 
3
+ ## [0.3.0] - 2022-08-18
4
+
5
+ - Added the params "more_indicator" to "limit_print"
6
+ - Added function: to_i to Boolean
7
+ - Updated RBS
8
+ - Added function
9
+
3
10
  ## [0.2.0] - 2022-08-17
4
11
 
5
12
  - to_yes_no function can now handle diffident casing
@@ -7,6 +14,6 @@
7
14
  ## [0.1.0] - 2022-08-14
8
15
 
9
16
  - Initial release
10
- - Added function: to_yn
11
- - Added function: to_yes_no
12
- - Added function: limit_print
17
+ - Added function: to_yn to Boolean
18
+ - Added function: to_yes_no to Boolean
19
+ - Added function: limit_print to String
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- render-text-helper (0.2.0)
4
+ render-text-helper (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -17,8 +17,10 @@ If bundler is not being used to manage dependencies, install the gem by executin
17
17
  ### Limit Print
18
18
 
19
19
  This function makes sure that the string does not go over a specific given limit.
20
- It has two parameters "limit" which is defaulted to 32 and "more_indicator" which
21
- defaults to "."
20
+ It has three parameters.
21
+ "limit" which is defaulted to 32 and controls how far to show the characters.
22
+ "more_indicator" which defaults to "." and controls which character to use to indicate there are more.
23
+ "indicator_length" which defaults to 3 and controls how many times to show the more indicator.
22
24
 
23
25
  ```ruby
24
26
  'hello'.limit_print
@@ -27,11 +29,14 @@ defaults to "."
27
29
  'elephant'.limit_print(limit: 2)
28
30
  'el...'
29
31
 
30
- 'elephant'.limit_print(limit: 2, more_indicator: '')
32
+ 'elephant'.limit_print(limit: 2, indicator_length: 0)
31
33
  'el'
32
34
 
33
35
  'elephant'.limit_print(limit: 3, more_indicator: '_')
34
36
  'ele___'
37
+
38
+ 'elephant'.limit_print(limit: 4, more_indicator: '*', indicator_length: 2)
39
+ 'elep**'
35
40
  ```
36
41
 
37
42
  ### to yes no
@@ -72,6 +77,10 @@ false.to_yn(capital_letter: false)
72
77
  'n'
73
78
  ```
74
79
 
80
+ ### to_i
81
+
82
+ Returns 1 for true and 0 for false on a boolean object.
83
+
75
84
  ## Contributing
76
85
 
77
86
  Bug reports and pull requests are welcome on GitHub at https://github.com/SaimonL/render-text-helper
@@ -18,6 +18,10 @@ module BooleanHelper
18
18
  'no'.send(casting.to_sym)
19
19
  end
20
20
  end
21
+
22
+ def to_i
23
+ self ? 1 : 0
24
+ end
21
25
  end
22
26
 
23
27
  class TrueClass
@@ -3,9 +3,9 @@
3
3
  # Adds function to existing String class
4
4
  class String
5
5
  # output the string giving the limit. It does not touch the string
6
- def limit_print(limit: 32, more_indicator: '.')
6
+ def limit_print(limit: 32, more_indicator: '.', indicator_length: 3)
7
7
  return self if size < limit
8
8
 
9
- [self[0...limit], more_indicator, more_indicator, more_indicator].join
9
+ [self[0...limit], (more_indicator * indicator_length)].join
10
10
  end
11
11
  end
@@ -3,7 +3,7 @@
3
3
  module Render
4
4
  module Text
5
5
  module Helper
6
- VERSION = '0.2.0'
6
+ VERSION = '0.3.0'
7
7
  end
8
8
  end
9
9
  end
@@ -4,13 +4,17 @@ module Render
4
4
  class TrueClass
5
5
  def to_yn: (capital_letter: bool) -> String
6
6
 
7
- def to_yes_no: (capital_letter: bool) -> String
7
+ def to_yes_no: (casting: Symbol) -> String
8
+
9
+ def to_i: -> Integer
8
10
  end
9
11
 
10
12
  class FalseClass
11
13
  def to_yn: (capital_letter: bool) -> String
12
14
 
13
- def to_yes_no: (capital_letter: bool) -> String
15
+ def to_yes_no: (casting: Symbol) -> String
16
+
17
+ def to_i: -> Integer
14
18
  end
15
19
  end
16
20
  end
@@ -2,7 +2,7 @@ module Render
2
2
  module Text
3
3
  module Helper
4
4
  class String
5
- def limit_print: (limit: Integer, more_indicator: String) -> String
5
+ def limit_print: (limit: Integer, more_indicator: String, indicator_length: Integer) -> String
6
6
  end
7
7
  end
8
8
  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.2.0
4
+ version: 0.3.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-17 00:00:00.000000000 Z
11
+ date: 2022-08-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Limit the render text, convert boolean to text etc
14
14
  email: