Sha256: b55a2bf75d18edd2f24b008f4193eb5334fa9ea86895dc4b38af2acc9e541a16

Contents?: true

Size: 544 Bytes

Versions: 10

Compression:

Stored size: 544 Bytes

Contents

module FSM
  module Options
    module InstanceMethods
      def assert_options(options, optional_keys = {}, mandatory_keys = {})
        keys_processed = []
        mandatory_keys.each do |key|
          raise ArgumentError.new("Mandatory Key #{key} is missing") unless options.keys.include?(key)
          keys_processed << key
        end
        options.keys.each do |key|
          raise ArgumentError.new("Unsupported key #{key}") unless optional_keys.include?(key) || mandatory_keys.include?(key)
        end
      end 
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
simplificator-fsm-0.2.2 lib/fsm/options.rb
simplificator-fsm-0.2.3 lib/fsm/options.rb
simplificator-fsm-0.2.4 lib/fsm/options.rb
simplificator-fsm-0.3.0 lib/fsm/options.rb
simplificator-fsm-0.3.2 lib/fsm/options.rb
simplificator-fsm-0.3.3 lib/fsm/options.rb
simplificator-fsm-0.3.5 lib/fsm/options.rb
simplificator-fsm-0.3.9 lib/fsm/options.rb
simplificator-fsm-0.3.8 lib/fsm/options.rb
simplificator-fsm-0.3.7 lib/fsm/options.rb