Sha256: d4b716047cd7aa92e66a2df645c00cd9848cc483ae02a571d2df7b64f6ac0fdb

Contents?: true

Size: 487 Bytes

Versions: 7

Compression:

Stored size: 487 Bytes

Contents

# -*- coding: utf-8 -*-


module Xot


  module Setter

    def set (*args)
      first = args.shift
      if first.kind_of? Hash
        first.each {|name, value| set_value__ name, value}
      else
        set_value__ first, *args
      end
    end

    private

      def set_value__ (name, *values)
        raise ArgumentError, "set '#{values}' to '#{name}'" if
          !name || name.empty? || values.empty?
        __send__ "#{name}=", *values
      end

  end# Setter


end# Xot

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
xot-0.1.21 lib/xot/setter.rb
xot-0.1.20 lib/xot/setter.rb
xot-0.1.19 lib/xot/setter.rb
xot-0.1.16 lib/xot/setter.rb
xot-0.1.15 lib/xot/setter.rb
xot-0.1.14 lib/xot/setter.rb
xot-0.1.13 lib/xot/setter.rb