Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add OptionHash#valid_keys

  • Loading branch information...
commit a4064c482edcdd7200ed1885eb555fdcc2336484 1 parent 1399fa5
@minad minad authored
Showing with 5 additions and 0 deletions.
  1. +4 −0 lib/temple/hash.rb
  2. +1 −0  lib/temple/mixins/options.rb
View
4 lib/temple/hash.rb
@@ -81,6 +81,10 @@ def update(hash)
super
end
+ def valid_keys
+ keys.concat(@valid.keys).uniq
+ end
+
def add(*keys)
keys.flatten.each { |key| @valid[key] = true }
end
View
1  lib/temple/mixins/options.rb
@@ -36,6 +36,7 @@ def self.included(base)
attr_reader :options
def initialize(opts = {})
+ raise ArgumentError, "Options must be given as hash" unless opts.keys
self.class.default_options.validate_hash!(opts)
@options = ImmutableHash.new(opts, self.class.default_options)
end
Please sign in to comment.
Something went wrong with that request. Please try again.