Sha256: 0f5c8cf86b40c77ea5adba41fb9a318029be4a0b0827c4f3af3193e8762fa637
Contents?: true
Size: 740 Bytes
Versions: 11
Compression:
Stored size: 740 Bytes
Contents
module ParkingTicket class Configuration def self.attr_required(*configuration_keys) define_method('attr_required') do configuration_keys end configuration_keys.each do |configuration_key| define_method configuration_key.to_s do instance_variable_get("@#{configuration_key}") end define_method "#{configuration_key}=" do |value| instance_variable_set("@#{configuration_key}", value) end end end def initialize @attr_required = defined?(attr_required) ? attr_required : [] yield(self) end def completed? @attr_required.all? { |attribute_required| instance_variable_get("@#{attribute_required}") } end end end
Version data entries
11 entries across 11 versions & 1 rubygems