Sha256: d514e7e7a6036f98ad3e62ebc890ff5da9f7d6e20f034f1edc88d5fd9f5c54a1
Contents?: true
Size: 786 Bytes
Versions: 3
Compression:
Stored size: 786 Bytes
Contents
# typed: false # frozen_string_literal: true 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
parking_ticket-1.0.51 | lib/parking_ticket/configuration.rb |
parking_ticket-1.0.50 | lib/parking_ticket/configuration.rb |
parking_ticket-1.0.49 | lib/parking_ticket/configuration.rb |