aromat 0.5.2 → 1.0.0

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: 2284d9cabc986b5672de5ab928ae339b647fb692
4
- data.tar.gz: 16485e6f1fca2536314a7b58f4d0fa37976d1918
3
+ metadata.gz: 709297778b3caa94ab4766f212c03a69b0b157b0
4
+ data.tar.gz: 6aaa9cf511abf07e3bf7272bbed89aec34a0bf6b
5
5
  SHA512:
6
- metadata.gz: 6d9af7c5e082d240082b214ec57f16426688aa6e5c5ca78b94f4a5681a3d3580f6b0ea76147bb1333ec7e15542497c5ef914586ef0db827c8f722598e484c021
7
- data.tar.gz: 57434a9a4dd301051f4ff9eec846634b469e40594f2109cda43f2f867ac8251b0a27d20e4cdff81d5c51954a80c02df965ad1f989ceff1131da5b9b7cbb894c5
6
+ metadata.gz: 16464baf14f57fe5fca36633f883fc211cbaf96e0d6aa79be8ec37d3c5348657ff1b54b6dfa14936d90ea2f6e2a0263a00507586b151c29f692923f287d14285
7
+ data.tar.gz: eac91efd63c038c1821e97ec7eee800eb0996b9f57df6db980876422f3f4f28edb019a2ec15c2304c9581e65289fe89c7e73f6e6e769fefbc240b85a607bbac8
data/lib/aromat/dclone.rb CHANGED
@@ -7,18 +7,21 @@ module Aromat
7
7
  # Dclone Module
8
8
  module Dclone
9
9
 
10
- # Base Clone
11
- # Clone the object if possible
10
+ # Base Clone:
11
+ # Clone the object if possible.
12
+ # @param [Object] e Any object
13
+ # @return [Object] A clone of e
12
14
  def self.base_clone e
13
15
  e.clone rescue e
14
16
  end
15
17
  end
16
18
  end
19
+
17
20
  # Monkey-patch Array Class
18
21
  class Array
19
22
 
20
- # Deep-Clone
21
- # Recursively clones every level of the Array
23
+ # Deep-Clone:
24
+ # Recursively clones every level of the Array.
22
25
  # @return [Array] A copy of the original array where each element has been clone'd
23
26
  def dclone
24
27
  collect { |a| a.respond_to?(:dclone) ? a.dclone : Aromat::Dclone.base_clone(a) }
@@ -28,8 +31,8 @@ end
28
31
  # Monkey-patch Hash Class
29
32
  class Hash
30
33
 
31
- # Deep-Clone
32
- # Recursively clones every level of the Hash
34
+ # Deep-Clone:
35
+ # Recursively clones every level of the Hash.
33
36
  # @return [Hash] A copy of the original hash where each element has been clone'd
34
37
  def dclone
35
38
  Hash[*(inject([]) { |a, e| a + e }.collect { |e| e.respond_to?(:dclone) ? e.dclone : Aromat::Dclone.base_clone(e) })]
data/lib/aromat/nstr.rb CHANGED
@@ -4,7 +4,8 @@
4
4
  # Monkey-patch String Class
5
5
  class String
6
6
 
7
- # Non-Empty String
7
+ # Non-Empty String:
8
+ # Eliminate Empty Strings.
8
9
  # @return [String] The string if non-empty, nil otherwise
9
10
  def nstr
10
11
  self == '' ? nil : self
data/lib/aromat/pad.rb CHANGED
@@ -4,8 +4,8 @@
4
4
  # Monkey-patch String Class
5
5
  class String
6
6
 
7
- # Right-Pad
8
- # Right-Pads a String to a given length using a given filler
7
+ # Right-Pad:
8
+ # Right-Pads a String to a given length using a given filler.
9
9
  # @param [Fixnum] size
10
10
  # @param [String] fill
11
11
  # @return [String] A copy of the original String, padded to [size] with [fill]
@@ -15,8 +15,8 @@ class String
15
15
  s.slice 0, size
16
16
  end
17
17
 
18
- # Left-Pad
19
- # Left-Pads a String to a given length using a given filler
18
+ # Left-Pad:
19
+ # Left-Pads a String to a given length using a given filler.
20
20
  # @param [Fixnum] size
21
21
  # @param [String] fill
22
22
  # @return [String] A copy of the original String, padded to [size] with [fill]
@@ -4,8 +4,8 @@
4
4
  # Monkey-patch Array Class
5
5
  class Array
6
6
 
7
- # Symbolize Keys
8
- # Recursively symbolizes hash keys
7
+ # Symbolize Keys:
8
+ # Recursively symbolizes hash keys.
9
9
  # @return [Array] A copy of the original array where each element has had its keys recursively symbolized
10
10
  def sym_keys
11
11
  collect { |e| e.respond_to?(:sym_keys) ? e.sym_keys : e }
@@ -15,8 +15,8 @@ end
15
15
  # Monkey-patch Hash Class
16
16
  class Hash
17
17
 
18
- # Symbolize Keys
19
- # Recursively symbolizes hash keys
18
+ # Symbolize Keys:
19
+ # Recursively symbolizes hash keys.
20
20
  # @return [Hash] A copy of the original hash where each element has had its keys recursively symbolized
21
21
  def sym_keys
22
22
  Hash[*(inject([]) { |a, e| (a << (e[0].respond_to?(:to_sym) ? e[0].to_sym : e[0])) << (e[1].respond_to?(:sym_keys) ? e[1].sym_keys : e[1]) })]
data/lib/aromat/try.rb CHANGED
@@ -4,7 +4,11 @@
4
4
  # Monkey-patch Object Class
5
5
  class Object
6
6
 
7
- # Try
7
+ # Try:
8
+ # Call a method if possible, do nothing otherwise.
9
+ # @param [Symbol] meth Method name
10
+ # @param [Array] args Method arguments
11
+ # @param [Object] block Method block
8
12
  def try meth, *args, &block
9
13
  return nil unless respond_to? meth
10
14
  send meth.to_sym, *args, &block
@@ -5,5 +5,5 @@
5
5
  module Aromat
6
6
 
7
7
  # Version
8
- VERSION = '0.5.2'
8
+ VERSION = '1.0.0'
9
9
  end
data/lib/aromat.rb CHANGED
@@ -9,7 +9,7 @@ require 'aromat/nstr'
9
9
  require 'aromat/pad'
10
10
  require 'aromat/try'
11
11
 
12
- # Aromat Module
13
- # Root Module for Aromat
12
+ # Aromat Module:
13
+ # Root Module for Aromat.
14
14
  module Aromat
15
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aromat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-23 00:00:00.000000000 Z
11
+ date: 2017-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler