class Spoonerize::Config
Runtime options used by the CLI and Spoonerism instances.
Attributes
When true, only consonant-starting words are eligible to be flipped.
@return [Boolean]
Words that should not be altered.
@return [Array]
Lazy mode. If true, words in lazy_words will not be altered.
@return [Boolean]
Words to skip when lazy is true.
@return [Array]
Name of the log file. Should be a fully-qualified file path.
@return [String]
When true, reverse the order of the flipping. Only makes a difference when there are more than two flip-able words.
@return [Boolean]
Public Class Methods
Source
# File lib/spoonerize/config.rb, line 48 def initialize @lazy = false @lazy_words = %w[i a an and in of the my your his her him hers to is] @excluded_words = [] @consonants_only = false @reverse = false @logfile_name = File.expand_path( File.join(ENV["HOME"], ".cache", "spoonerize", "spoonerize.csv") ) end
Create instance of Config.
@return [Spoonerize::Config]
Public Instance Methods
Source
# File lib/spoonerize/config.rb, line 63 def with(**overrides) self.class.new.tap do |config| config.lazy = lazy config.lazy_words = lazy_words.dup config.excluded_words = excluded_words.dup config.consonants_only = consonants_only config.reverse = reverse config.logfile_name = logfile_name overrides.each do |key, value| config.public_send(:"#{key}=", copy_value(value)) end end end
Create a copy of the current config with optional overrides.
@return [Spoonerize::Config]