structure 0.27.6 → 0.27.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/structure.rb +7 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 118caad7cf3818df6269396705dd439fba604ee5
|
4
|
+
data.tar.gz: 2e2740598ba800523a34b7458ee88e7da367600d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f31ccce5416479862f5198f0342fb8f09a880a468a29551a70bd780477c4fa2a0e41071d793b7b139e17592a6a8560a575dd4ec3edb40091348a5f3016010ead
|
7
|
+
data.tar.gz: 1eb9198a77d800ac82715014afbcae9f1bee0e90fecaa77ed9b6beff6c5f3c8e9140f1638f79359d7256d690a1fec9cb12ca6ce82fefc7ff07ec2cee23a8fb82
|
data/structure.rb
CHANGED
@@ -18,7 +18,9 @@ module Structure
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def inspect
|
21
|
-
|
21
|
+
class_name = self.class.name || self.class.to_s.match(/#<(.*)>/)[1]
|
22
|
+
|
23
|
+
"#<#{class_name} #{
|
22
24
|
attributes
|
23
25
|
.map { |key, val|
|
24
26
|
if val.is_a?(Array) && val.size > 3
|
@@ -38,7 +40,7 @@ module Structure
|
|
38
40
|
module ClassMethods
|
39
41
|
attr_reader :attribute_names
|
40
42
|
|
41
|
-
def to_struct
|
43
|
+
def to_struct(&blk)
|
42
44
|
class_name = name || to_s.gsub(/\W/, '')
|
43
45
|
|
44
46
|
if Struct.const_defined?(class_name, false)
|
@@ -51,9 +53,11 @@ module Structure
|
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
56
|
+
klass.module_eval(&blk) if block_given?
|
57
|
+
|
54
58
|
attribute_names.each do |name|
|
55
59
|
if instance_methods(false).include?(:"#{name}?")
|
56
|
-
klass.module_eval "def #{name}?; #{name} end"
|
60
|
+
klass.module_eval "def #{name}?; #{name}; end"
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.
|
4
|
+
version: 0.27.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hakan Ensari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: me@hakanensari.com
|
@@ -37,7 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
37
|
version: '0'
|
38
38
|
requirements: []
|
39
39
|
rubyforge_project:
|
40
|
-
rubygems_version: 2.
|
40
|
+
rubygems_version: 2.3.0
|
41
41
|
signing_key:
|
42
42
|
specification_version: 4
|
43
43
|
summary: Parses data into value objects
|