Sha256: a9492e078eb14b1b75b8870e00bc01e82d7b0aea60dac4b5ebdd597efc840100
Contents?: true
Size: 584 Bytes
Versions: 1
Compression:
Stored size: 584 Bytes
Contents
# -*- encoding: utf-8 -*- # frozen_string_literal: true module K module Replace module DynamicAccessors def create_accessors(attributes) @_dynamic_attributes = attributes.with_indifferent_access @_dynamic_attributes.each_with_index do |attribute, index| create_accessor attribute[0].to_s end end private def create_accessor(name) class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name} @_dynamic_attributes["#{name}"] end RUBY end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
k-replace-1.0.0 | lib/k/replace/dynamic_accessors.rb |