six 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. data/lib/six.rb +11 -1
  2. metadata +2 -2
data/lib/six.rb CHANGED
@@ -11,12 +11,22 @@ class Six
11
11
  end
12
12
  end
13
13
 
14
+ class InitializeArgumentError < StandardError
15
+ def message
16
+ "Six.new require hash as pack argument in format {:name_of_pack => PackRules.new}"
17
+ end
18
+ end
19
+
14
20
  attr_reader :rules_packs
15
21
  attr_reader :current_rule_pack
16
22
 
17
- def initialize()
23
+ def initialize(packs={})
24
+ raise InitializeArgumentError.new unless packs.kind_of?(Hash)
25
+
18
26
  @rules_packs = {}
19
27
  @current_rule_pack = nil
28
+
29
+ packs.each { |key, pack| add_pack!(key, pack) }
20
30
  end
21
31
 
22
32
  # Set current pack from stored packs by key
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: six
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
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: 2011-08-27 00:00:00.000000000Z
12
+ date: 2011-09-01 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Very simple authorization gem
15
15
  email: dmitriy.zaporozhets@gmail.com