aromat 0.4.0 → 0.5.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 +4 -4
- data/README.md +17 -2
- data/lib/aromat/nstr.rb +12 -0
- data/lib/aromat/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a05b3f2d5d2f433784d344e6688c8f81eaec0f0
|
4
|
+
data.tar.gz: af6c4b10177aa51619d6baf148d3acec7c456fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a71047aa1b2f9d68f67b01a0987e2f7485cd434f1e79cc84e58f6e579bf0fe061fa6e4c65d89b5ecf9ee0ad03d12f4cd7d3299eb20777138ec17141cd98c32d2
|
7
|
+
data.tar.gz: 717e14bf9518ed297b1954320e9488b6c9b2d0ef66fe2a5a05e5032bb565b8ed47e83607bc6d152cb46624d5e57f85be48449873ae126825fc1191e1ced80900
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ b
|
|
49
49
|
# => {:foo=>"bar", :nested=>[{:problems=>"none"}]}
|
50
50
|
```
|
51
51
|
|
52
|
-
### Padding
|
52
|
+
### Right/Left Padding
|
53
53
|
|
54
54
|
Two padding methods _rpad_ and _lpad_ are monkey-patched into the *String* class, and provide a way to pad any string to a given length using a given filler string.
|
55
55
|
|
@@ -69,7 +69,7 @@ a.rpad 2, '-'
|
|
69
69
|
# => "oo"
|
70
70
|
```
|
71
71
|
|
72
|
-
### Try
|
72
|
+
### Object Try (Undefined Method Call)
|
73
73
|
|
74
74
|
A _try_ method is monkey-patched into the *Object* root class, providing a means to call undefined methods on objects without raising anything (returning *nil* instead).
|
75
75
|
|
@@ -82,6 +82,21 @@ A _try_ method is monkey-patched into the *Object* root class, providing a means
|
|
82
82
|
# => 35
|
83
83
|
```
|
84
84
|
|
85
|
+
### Get Non-Empty String
|
86
|
+
|
87
|
+
A _nstr_ method is monkey-patched into the *String* class. This method returns nil when the String is empty, the String otherwise.
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
''.nstr
|
91
|
+
# => nil
|
92
|
+
'foo'.nstr
|
93
|
+
# => 'foo'
|
94
|
+
nil.try :nstr
|
95
|
+
# => nil
|
96
|
+
'bar'.try :nstr
|
97
|
+
# => 'bar'
|
98
|
+
```
|
99
|
+
|
85
100
|
## License
|
86
101
|
|
87
102
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/aromat/nstr.rb
ADDED
data/lib/aromat/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aromat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eresse
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- aromat.gemspec
|
68
68
|
- lib/aromat.rb
|
69
69
|
- lib/aromat/dclone.rb
|
70
|
+
- lib/aromat/nstr.rb
|
70
71
|
- lib/aromat/pad.rb
|
71
72
|
- lib/aromat/sym_keys.rb
|
72
73
|
- lib/aromat/try.rb
|