Sha256: 7ee8b7f0f73efc5020f7079f8f4272898141ff1e43545c8f91df061f42fc4e4b

Contents?: true

Size: 420 Bytes

Versions: 1

Compression:

Stored size: 420 Bytes

Contents

module Tori
  module Define
    def tori(name)
      name_file_ivar = "@#{name}_file".to_sym

      define_method(name) do
        ivar = instance_variable_get name_file_ivar
        instance_variable_set name_file_ivar, ivar || File.new(self)
      end

      define_method("#{name}=") do |uploader|
        file = File.new(self, uploader)
        instance_variable_set name_file_ivar, file
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tori-0.0.3 lib/tori/define.rb