scash 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ca63f62a3a547a270de30db0dfbf4bce4e89b3b
4
- data.tar.gz: 838cac9bc4bdf707fc6fb41e9e703fd391581f0d
3
+ metadata.gz: 50b2f94b76de1c9fbd0867043e4d130ee069368e
4
+ data.tar.gz: b7cdbf6ad0bbb527cc4a3be066bd48ac79a5e284
5
5
  SHA512:
6
- metadata.gz: ddbe88cad88ac90cac55fe7764e8095efe299fcb4a8ff36b6183de66950e4ac9aa1f68f0891caf8255f560920de6bec243a88e0eb7d8a5b6b9a157cae9ecfde4
7
- data.tar.gz: 8dd27424bb5f2e13fbb4f2ebe7892ec74c0e4a07736337a54947b97056623f2a1c42780b6ec8d3113a72cf3214bc2b7fded398c2bdcf83d40d0994ac827de282
6
+ metadata.gz: eb1f0bfb1cc25491e14415880a779b4d1bd57408b67d110c375fca3564a6621129fab4b5fd26543d73dc1cca578c47a9f48fa4eb519c3c203ef6f7342a0536d1
7
+ data.tar.gz: 8cca5809b87ea8571e20a1c830b3bdafe6442b672fb7eeec1d515aebad3ddb9b3350562b86d1fe21dbdcec2b9bc4847ae4a8b318cfdc802e046591a7715fe8f4
data/lib/scash.rb CHANGED
@@ -11,8 +11,7 @@ class Scash
11
11
  attr_reader :stack
12
12
 
13
13
  def initialize(variables = {})
14
- raise NotImplementedError if variables.any?
15
- @stack = []
14
+ @stack = [variables.with_indifferent_access]
16
15
  end
17
16
 
18
17
  def to_hash
data/lib/scash/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Scash
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/test/test_scash.rb CHANGED
@@ -61,6 +61,19 @@ class TestScash < Minitest::Test
61
61
  assert_equal({}, scash.to_hash)
62
62
  end
63
63
 
64
+ it "should accept variables in initializer" do
65
+ scash = Scash.new({:a => 1})
66
+ assert_equal 1, scash[:a]
67
+ assert_equal({"a" => 1}, scash.to_hash)
68
+ scash.with({:b => 2}) do
69
+ assert_equal 1, scash[:a]
70
+ assert_equal 2, scash[:b]
71
+ scash.define_global_variables :c => 3
72
+ end
73
+ assert_equal 1, scash[:a]
74
+ assert_equal 3, scash[:c]
75
+ end
76
+
64
77
  it "should reuse instances" do
65
78
  class Foo
66
79
  attr_accessor :bar
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scash
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
  - Stephan Kaag