parametric 0.2.13 → 0.2.14

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
  SHA256:
3
- metadata.gz: 961d47f5a52e85cd54ea1aae3dde404423941e447896268370a360ba5cadf251
4
- data.tar.gz: 006fbd9de033ab5d444e90f65ee81af5883ca380476e2de160bd700c9dc786ee
3
+ metadata.gz: 40164472fa5f68d604b2f20b6823b4b7c0ca81136c46826705d3a3a4b2e903f2
4
+ data.tar.gz: 1bce90d98794e1cc1a169bea9ff0b6d606486a9a2e33b95b0e461cfaae567c63
5
5
  SHA512:
6
- metadata.gz: 6a9b313400492d1f152ec94544ace651cdbbd91f579b3b99b668f06ea2c9861b8c0e80d1605e76f1b41a48aacd4d1e847fa840e60dbe34d9f88c8c6382371b01
7
- data.tar.gz: 14e46b0e54fb309dd5be8fa1aeb10bf2363f7211bfae31e004135458f84319f4e38692e7322f988fe38228ddda8d1003f748c3bfb301510e694f32a5599e1c40
6
+ metadata.gz: 0b93f931277e786ea4f6a39d2db2a8152be14a9887c4a31bfb54a38c5127c85bf43b6e35e442b4b9cc40531879d5638ed234b4e62102cffb23c5b2bf12552c6e
7
+ data.tar.gz: ca54de8f1cc1aaf4b0cb4805197e634ab07ecabf31cab56a54e3fca330312c3b247a984d5efabef9350729008e1f319730a74b1b068f6685eb6f9c74ddda71aa
@@ -38,6 +38,10 @@ module Parametric
38
38
  _results.output.clone
39
39
  end
40
40
 
41
+ def [](key)
42
+ _results.output[key.to_sym]
43
+ end
44
+
41
45
  def ==(other)
42
46
  other.respond_to?(:to_h) && other.to_h.eql?(to_h)
43
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parametric
4
- VERSION = "0.2.13"
4
+ VERSION = "0.2.14"
5
5
  end
data/spec/struct_spec.rb CHANGED
@@ -40,6 +40,10 @@ describe Parametric::Struct do
40
40
  expect(instance.friends.first.name).to eq 'Ismael'
41
41
  expect(instance.friends.first).to be_a friend_class
42
42
 
43
+ # Hash access with #[]
44
+ expect(instance[:title]).to eq instance.title
45
+ expect(instance[:friends].first[:name]).to eq instance.friends.first.name
46
+
43
47
  invalid_instance = klass.new({
44
48
  friends: [
45
49
  {name: 'Ismael', age: 40},
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parametric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-24 00:00:00.000000000 Z
11
+ date: 2021-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake