Sha256: fdd2ce3dcfef77a30c7384332aafb4f0b188b159cf8bc122780e8dadc2de43a4

Contents?: true

Size: 491 Bytes

Versions: 13

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

require 'immutable_struct_ex'
require_relative 'options'
require_relative 'options_validatable'

module MadFlatter
  # Defines methods and attributes to manage options.
  module Optionable
    include OptionsValidatable

    def options
      @options || Options.default
    end

    private

    def options=(value)
      options_hash = value.to_h

      validate_options! options: options_hash

      @options = Options.new(**options_hash)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mad_flatter-3.0.8 lib/mad_flatter/optionable.rb
mad_flatter-3.0.7 lib/mad_flatter/optionable.rb
mad_flatter-3.0.6 lib/mad_flatter/optionable.rb
mad_flatter-3.0.5 lib/mad_flatter/optionable.rb
mad_flatter-3.0.4 lib/mad_flatter/optionable.rb
mad_flatter-3.0.3 lib/mad_flatter/optionable.rb
mad_flatter-3.0.2 lib/mad_flatter/optionable.rb
mad_flatter-3.0.1 lib/mad_flatter/optionable.rb
mad_flatter-3.0.0 lib/mad_flatter/optionable.rb
mad_flatter-2.1.0 lib/mad_flatter/optionable.rb
mad_flatter-2.0.0 lib/mad_flatter/optionable.rb
mad_flatter-1.0.1.pre.beta lib/mad_flatter/optionable.rb
mad_flatter-1.0.0.pre.beta lib/mad_flatter/optionable.rb