Sha256: 345ae86f82caa31116b9e8de2063fa3b0c2fb361c05ee8ae6ba2a1e58992af81

Contents?: true

Size: 651 Bytes

Versions: 14

Compression:

Stored size: 651 Bytes

Contents

module Access
  module MuchMeta

    def set_up_methods(values)
      self.class.class_eval do
        if Access.config.access_used_fields == 'true'
          attr_reader :used_fields
          values.keys.each do |key|
            define_method(key.to_sym) do
              @used_fields << key.to_sym
              instance_variable_get("@#{key.to_sym}")
            end
          end
        else
          attr_reader(*values.keys)
        end
      end
    end

    def set_values(values)
      values.each do |attribute_name, attribute_value|
        self.instance_variable_set("@#{attribute_name}", attribute_value)
      end
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
access-2.3.0.pre.rc2 lib/access/much_meta.rb
access-2.3.0.pre.rc1 lib/access/much_meta.rb
access-2.2.0 lib/access/much_meta.rb
access-2.1.5 lib/access/much_meta.rb
access-2.1.4 lib/access/much_meta.rb
access-2.1.3 lib/access/much_meta.rb
access-2.1.2 lib/access/much_meta.rb
access-2.1.1 lib/access/much_meta.rb
access-2.1.0 lib/access/much_meta.rb
access-2.0.55 lib/access/much_meta.rb
access-2.0.54 lib/access/much_meta.rb
access-2.0.53 lib/access/much_meta.rb
access-2.0.52 lib/access/much_meta.rb
access-2.0.51 lib/access/much_meta.rb