Sha256: 242363c8a9b1c33a037864b42dff8b6ed19a6612e671b68b00da2517a2e90951
Contents?: true
Size: 558 Bytes
Versions: 4
Compression:
Stored size: 558 Bytes
Contents
module ActiveMocker class Field attr_reader :name, :type, :options def initialize(name: name, type: type, options: options) @name = name @type = type @options = options create_option_methods end def to_h {name: name, type: type, options: options} end def create_option_methods options.each do |opt| key, value = opt.first self.instance_variable_set("@#{key}", value) define_singleton_method(key) {instance_variable_get("@#{key}")} end end end end
Version data entries
4 entries across 4 versions & 1 rubygems