better_struct 0.1.1 → 0.1.2

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: dc8476e9b0bfac1f0a22a964bb2c60976b4c77cb
4
- data.tar.gz: 7891ca24813b4c89121d41c2a45df7c83b6aca0b
3
+ metadata.gz: 7412170d20c983591a234c44890b2193d6de770b
4
+ data.tar.gz: 33be1a359fde94fc3a4e12456f1fd2bb334a0246
5
5
  SHA512:
6
- metadata.gz: a00617ec16d36bdb06dc99507c18578759c91d2056e0e378ef54f77a4a062bd8edb1a4a9a293330d7affc049485d59f028f49350e49f7bfaf8c26ff5f2ff61f9
7
- data.tar.gz: b4a52b03b5b5ed08db5e5311d193231ef2b1757112bd8594858c2ebc2028a443e1a549493386aaed3e822e2aab6791bd13e0d195fcb74a80959468571dda9612
6
+ metadata.gz: 0a5c7bf02dad0688bdd984d6f14561ecc92d032d50f8c56176dfad561ac6fb4fd01f5d42b3041a2845700a84a3839a520b379cef8ec0bad4a79fb92d5791149f
7
+ data.tar.gz: 540cac12c69851eafbd2d43070c0df506f763a3a2a2fa9691cc21a8a2f0ec02ede6c264dcad5321fb73e8a60ef0376438b2622bd4a01c552db1d60b87c43e02a
@@ -1,3 +1,3 @@
1
1
  class BetterStruct
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/better_struct.rb CHANGED
@@ -45,7 +45,7 @@ private
45
45
  word = camel_cased_word.to_s.gsub(/::/, '/')
46
46
  word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
47
47
  word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
48
- word.tr!("-", "_")
48
+ word.tr!("- ", "_")
49
49
  word.downcase!
50
50
  word
51
51
  end
@@ -54,4 +54,13 @@ class BetterStructTest < Minitest::Test
54
54
  assert !i.is_a?(BetterStruct)
55
55
  end
56
56
  end
57
+
58
+ def test_equality
59
+ assert BetterStruct.new(1) == BetterStruct.new(1.0)
60
+ assert BetterStruct.new(1) != 1
61
+ end
62
+
63
+ def test_underscoring_methods
64
+ assert BetterStruct.new({ "Word With-Space" => 1 }).word_with_space.value == 1
65
+ end
57
66
  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.1.1
4
+ version: 0.1.2
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-16 00:00:00.000000000 Z
11
+ date: 2015-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler