skn_utils 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/README.rdoc +4 -2
- data/lib/skn_utils/attribute_helpers.rb +4 -10
- data/lib/skn_utils/nested_result_base.rb +6 -0
- data/lib/skn_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5cfe73e125df779f79ce3be34a43d46d2dce65d
|
4
|
+
data.tar.gz: 303e5051dce3b79e74c3dd79d40dd69b36566eca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba7e278c5d8e5abe20f1a16036c923257dfa4c794256462cc3798fe1d3435f223c02996c83ba14c8c6ef260c2920507468e9ac5c4f44301f146da9026337f2d7
|
7
|
+
data.tar.gz: 3bf125a79c73587edd42526e23f65106b6146c90c804bc70e70bf328a31cc3aa2808bd79eab49589ae83310e95237e471e66a672b9218077952495c0cd077853
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/skn_utils.svg)](http://badge.fury.io/rb/skn_utils)
|
2
2
|
|
3
3
|
# SknUtils
|
4
|
-
Rails Gem containing a Ruby PORO (Plain Old Ruby Object) that can be instantiated at runtime with an input hash. This library creates
|
4
|
+
Rails Gem containing a Ruby PORO (Plain Old Ruby Object) that can be instantiated at runtime with an input hash. This library creates
|
5
|
+
an Object with instance variables and associated getters and setters for Dot or Hash notational access to each instance variable. Additional
|
6
|
+
instance variables can be added post-create by 'obj.my_new_var = "some value"', or simply assigning it.
|
5
7
|
|
6
8
|
|
7
|
-
The intent of this
|
9
|
+
The intent of this gem is to be a container of data results, with easy access to its contents with on-demand transformation to hash, xml, or json.
|
8
10
|
|
9
11
|
* If the key's value is also a hash, it too can optionally become an Object.
|
10
12
|
* if the key's value is a Array of Hashes, each element of the Array can optionally become an Object.
|
data/README.rdoc
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/skn_utils.svg)](http://badge.fury.io/rb/skn_utils)
|
2
2
|
|
3
3
|
= SknUtils
|
4
|
-
Rails Gem containing a Ruby PORO (Plain Old Ruby Object) that can be instantiated at runtime with an input hash. This library creates
|
4
|
+
Rails Gem containing a Ruby PORO (Plain Old Ruby Object) that can be instantiated at runtime with an input hash. This library creates
|
5
|
+
an Object with instance variables and associated getters and setters for Dot or Hash notational access to each instance variable. Additional
|
6
|
+
instance variables can be added post-create by 'obj.my_new_var = "some value"', or simply assigning it.
|
5
7
|
|
6
8
|
|
7
|
-
The intent of this
|
9
|
+
The intent of this gem is to be a container of data results, with easy access to its contents with on-demand transformation to hash, xml, or json.
|
8
10
|
|
9
11
|
* If the key's value is also a hash, it too can optionally become an Object.
|
10
12
|
* if the key's value is a Array of Hashes, each element of the Array can optionally become an Object.
|
@@ -31,9 +31,9 @@ module SknUtils
|
|
31
31
|
|
32
32
|
# return a hash of all attributes and their current values
|
33
33
|
# including nested arrays of hashes/objects
|
34
|
-
def attributes
|
34
|
+
def attributes(filter_internal=true)
|
35
35
|
instance_variable_names.each_with_object({}) do |attr,collector|
|
36
|
-
next if ['skn_enable_serialization', 'skn_enabled_depth'].include?(attr.to_s[1..-1])
|
36
|
+
next if ['skn_enable_serialization', 'skn_enabled_depth'].include?(attr.to_s[1..-1]) and filter_internal # skip control keys
|
37
37
|
value = instance_variable_get(attr)
|
38
38
|
next if value.is_a?(ActiveModel::Errors)
|
39
39
|
|
@@ -61,12 +61,6 @@ module SknUtils
|
|
61
61
|
send("#{attr}=", value)
|
62
62
|
end
|
63
63
|
|
64
|
-
# determines if this is one of our objects
|
65
|
-
#:nodoc:
|
66
|
-
def attribute_helper_object
|
67
|
-
true
|
68
|
-
end
|
69
|
-
|
70
64
|
##
|
71
65
|
# DO NOT ADD METHODS BELOW THIS LINE, unless you want them to be private
|
72
66
|
##
|
@@ -75,12 +69,12 @@ module SknUtils
|
|
75
69
|
# answering for any attr that method missing actually handle
|
76
70
|
#:nodoc:
|
77
71
|
def respond_to_missing?(method, incl_private=false)
|
78
|
-
instance_variable_names.include?("@#{method.to_s}")
|
72
|
+
instance_variable_names.include?("@#{method.to_s}") || super(method,incl_private)
|
79
73
|
end
|
80
74
|
|
81
75
|
private
|
82
76
|
|
83
|
-
# Deals with the true
|
77
|
+
# Deals with the true existance of an attribute and then its non-blank or empty value
|
84
78
|
# - attribute must exist and have a non-blank value to cause this method to return true
|
85
79
|
#:nodoc:
|
86
80
|
def attribute?(attr)
|
@@ -217,6 +217,12 @@ module SknUtils
|
|
217
217
|
@skn_enabled_depth
|
218
218
|
end
|
219
219
|
|
220
|
+
# determines if this is one of our objects
|
221
|
+
#:nodoc:
|
222
|
+
def attribute_helper_object
|
223
|
+
true
|
224
|
+
end
|
225
|
+
|
220
226
|
# Some keys have chars not suitable for symbol keys
|
221
227
|
#:nodoc:
|
222
228
|
def clean_key(original)
|
data/lib/skn_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skn_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Scott Jr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|