Sha256: c7fcdf92339f2c62711e6dcb6292d038a752a71edbcb67a7cf02a8d34db6c2f8

Contents?: true

Size: 413 Bytes

Versions: 1

Compression:

Stored size: 413 Bytes

Contents

require "assign/version"

module Assign
  class Assignable
    def initialize(obj)
      @target = obj
    end

    def method_missing(m, *args)
      m = @target.respond_to?(m) ? m : m.to_s.chomp('=')
      @target.__send__(m, *args)
    end

    def respond_to_missing?(m)
      @target.respond_to?(m.to_s.chomp('='))
    end
  end

  module ::Kernel
    def assign
      Assignable.new(self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
assign-0.1.0 lib/assign.rb