better_struct 0.0.3 → 0.0.4

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
  !binary "U0hBMQ==":
3
- metadata.gz: c413c7fb47cee774225d9ca7ef9da5bddf59181c
4
- data.tar.gz: 24ca5a390276c9f470d52b1d54c68bcbda6cfba0
3
+ metadata.gz: 60dc46874b353a8194a935de7f3dbd539be5dce8
4
+ data.tar.gz: 4b07a4ac506666b9f63688606571ec0fddf31c4e
5
5
  SHA512:
6
- metadata.gz: bee0f31a4b043844b8924cb02623a026c5194a9b6dfa1a79bfe0ab0ce20d8992df92eb008b7dd7cf942c229900419352c17b09b8d977c6951a63726b8f86476f
7
- data.tar.gz: b3e6e11e24100e44f286135c6146a6f6041fc7ffc92968fb21b4b263ebc6ea9e5d15de745ea10c12629c3935de39cec47d22c8294e527d137cb08c3473dfb06a
6
+ metadata.gz: e256d283c41f2715e7760aeafadd05c0c371d2d90c7cbfb83ba826207bbe1bea102c6a164004a07f6c6a976c9988fa5afb5417c400efaeb584083daf7b7d1798
7
+ data.tar.gz: 54c4cf5172f9d89bc1a282fa0e7bf9a1e035e68e670c13f09fcc7023da5aedcf3c2d92ed493728491bcd4731a3688cfddcb46b6f1848955fc9fd617a640c3933
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "minitest", "~> 5.5"
24
- spec.add_development_dependency "pry", "~> 0.10"
24
+ spec.add_development_dependency "pry-byebug", "~> 2.0"
25
25
  end
@@ -54,9 +54,15 @@ private
54
54
  method_name = args.first.to_s
55
55
 
56
56
  if value.respond_to?(method_name)
57
- wrap(value.public_send(*args, &wrap_block_arguments(*args, &block)))
57
+ result = wrap(value.public_send(*args, &wrap_block_arguments(*args, &block)))
58
+
59
+ method_name == "map" ? unwrap_items(result) : result
58
60
  else
59
61
  wrap(@defined_methods[method_name])
60
62
  end
61
63
  end
64
+
65
+ def unwrap_items(wrapped_array)
66
+ wrap(wrapped_array.value.map(&:value))
67
+ end
62
68
  end
@@ -1,3 +1,3 @@
1
1
  class BetterStruct
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -41,4 +41,17 @@ class BetterStructTest < Minitest::Test
41
41
 
42
42
  assert_equal better_struct.foo_bar1.foo_bar2, BetterStruct.new("Hello World!")
43
43
  end
44
+
45
+ def test_map_result
46
+ better_struct = BetterStruct.new([1, 2, 3])
47
+
48
+ mapped = better_struct.map do |i|
49
+ assert i.is_a?(BetterStruct)
50
+ i
51
+ end
52
+
53
+ mapped.value.each do |i|
54
+ assert !i.is_a?(BetterStruct)
55
+ end
56
+ end
44
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeny Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-14 00:00:00.000000000 Z
11
+ date: 2015-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,19 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.5'
55
55
  - !ruby/object:Gem::Dependency
56
- name: pry
56
+ name: pry-byebug
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0.10'
61
+ version: '2.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '0.10'
68
+ version: '2.0'
69
69
  description: Use your data without pain
70
70
  email:
71
71
  - exaspark@gmail.com