Sha256: 84c5d828e26c48392e2d79e1c58d45a488de02486444625c94e3c2a4a436dfa5

Contents?: true

Size: 462 Bytes

Versions: 18

Compression:

Stored size: 462 Bytes

Contents

module SmartIoC::Args
  def check_arg(value, name, klass)
    if !value.is_a?(klass)
      raise ArgumentError, ":#{name} should be a #{klass}"
    end
  end

  def check_arg_any(value, name, klasses)
    if !klasses.detect {|klass| value.is_a?(klass)}
      raise ArgumentError, ":#{name} should be any of #{klasses.inspect}"
    end
  end

  def not_nil(value, name)
    if value.nil?
      raise ArgumentError, ":#{name} should not be blank"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
smart_ioc-0.3.0 lib/smart_ioc/args.rb
smart_ioc-0.2.5 lib/smart_ioc/args.rb
smart_ioc-0.2.4 lib/smart_ioc/args.rb
smart_ioc-0.2.3 lib/smart_ioc/args.rb
smart_ioc-0.2.2 lib/smart_ioc/args.rb
smart_ioc-0.2.1 lib/smart_ioc/args.rb
smart_ioc-0.2.0 lib/smart_ioc/args.rb
smart_ioc-0.1.30 lib/smart_ioc/args.rb
smart_ioc-0.1.29 lib/smart_ioc/args.rb
smart_ioc-0.1.28 lib/smart_ioc/args.rb
smart_ioc-0.1.27 lib/smart_ioc/args.rb
smart_ioc-0.1.26 lib/smart_ioc/args.rb
smart_ioc-0.1.25 lib/smart_ioc/args.rb
smart_ioc-0.1.24 lib/smart_ioc/args.rb
smart_ioc-0.1.23 lib/smart_ioc/args.rb
smart_ioc-0.1.22 lib/smart_ioc/args.rb
smart_ioc-0.1.21 lib/smart_ioc/args.rb
smart_ioc-0.1.20 lib/smart_ioc/args.rb