simple_struct 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simple_struct.rb +6 -3
- metadata +4 -4
data/lib/simple_struct.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class SimpleStruct
|
2
2
|
|
3
|
-
VERSION = "0.0.
|
3
|
+
VERSION = "0.0.2"
|
4
4
|
|
5
5
|
def self.new *members, &block
|
6
6
|
subclass = Class.new(self)
|
@@ -17,11 +17,14 @@ class SimpleStruct
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.inspect
|
20
|
-
%[#{to_s}(#{members*', '})]
|
20
|
+
self == SimpleStruct ? super : %[#{to_s}(#{members*', '})]
|
21
21
|
end
|
22
22
|
|
23
23
|
def inspect
|
24
|
-
|
24
|
+
members = self.class.members.map do |member|
|
25
|
+
member.to_s + '=' + instance_variable_get("@#{member}").inspect
|
26
|
+
end
|
27
|
+
%(#<#{self.class}: #{members.join(', ')}>)
|
25
28
|
end
|
26
29
|
|
27
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: SimpleStruct is a lighter weight struct then ruby's standard struct.
|
15
15
|
email:
|
@@ -39,7 +39,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
39
39
|
version: '0'
|
40
40
|
segments:
|
41
41
|
- 0
|
42
|
-
hash:
|
42
|
+
hash: 3484219840914447131
|
43
43
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
44
|
none: false
|
45
45
|
requirements:
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '0'
|
49
49
|
segments:
|
50
50
|
- 0
|
51
|
-
hash:
|
51
|
+
hash: 3484219840914447131
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
54
|
rubygems_version: 1.8.24
|