cleanup module definitions

dev
Andy Meneely 2020-03-16 17:08:10 -04:00
parent 77a694f797
commit 21bee3a3cb
13 changed files with 399 additions and 439 deletions

View File

@ -1,12 +1,7 @@
module Squib module Squib::Args::ColorValidator
# @api private
module Args
module ColorValidator
def colorify(color, custom_colors = {}) def colorify(color, custom_colors = {})
custom_colors[color.to_s] || color.to_s custom_colors[color.to_s] || color.to_s
end end
end end
end
end

View File

@ -1,8 +1,9 @@
require_relative 'arg_loader' require_relative 'arg_loader'
module Squib module Squib::Args
# @api private module_function def extract_coord(opts, deck)
module Args Box.new.extract!(opts, deck)
end
class Coords class Coords
include ArgLoader include ArgLoader
@ -32,4 +33,3 @@ module Squib
end end
end end
end

View File

@ -1,8 +1,6 @@
require 'csv' require 'csv'
module Squib module Squib::Args
# @api private
module Args
class CSV_Opts class CSV_Opts
def initialize(opts) def initialize(opts)
@ -22,4 +20,3 @@ module Squib
end end
end end
end

View File

@ -1,7 +1,4 @@
module Squib module Squib::Args::DirValidator
# @api private
module Args
module DirValidator
def ensure_dir_created(dir) def ensure_dir_created(dir)
unless Dir.exists?(dir) unless Dir.exists?(dir)
@ -12,5 +9,3 @@ module Squib
end end
end end
end
end

View File

@ -1,8 +1,6 @@
require_relative 'arg_loader' require_relative 'arg_loader'
module Squib module Squib::Args
# @api private
module Args
class EmbedAdjust class EmbedAdjust
include ArgLoader include ArgLoader
@ -22,4 +20,3 @@ module Squib
end end
end end
end

View File

@ -1,9 +1,6 @@
require_relative 'arg_loader' require_relative 'arg_loader'
module Squib module Squib::Args
# @api private
module Args
class EmbedKey class EmbedKey
# Validate the embed lookup key # Validate the embed lookup key
@ -12,6 +9,4 @@ module Squib
end end
end end
end
end end

View File

@ -1,8 +1,6 @@
require 'cairo' require 'cairo'
module Squib module Squib::Args
# @api private
module Args
class HandSpecial class HandSpecial
include ArgLoader include ArgLoader
@ -34,4 +32,3 @@ module Squib
end end
end end
end

View File

@ -1,8 +1,6 @@
require_relative 'arg_loader' require_relative 'arg_loader'
module Squib module Squib::Args
# @api private
module Args
class Import class Import
include ArgLoader include ArgLoader
@ -37,4 +35,3 @@ module Squib
end end
end end
end

View File

@ -6,6 +6,7 @@ module Squib::Args
module_function def extract_paint(opts, deck) module_function def extract_paint(opts, deck)
Paint.new(deck.custom_colors).extract!(opts, deck) Paint.new(deck.custom_colors).extract!(opts, deck)
end end
class Paint class Paint
include ArgLoader include ArgLoader
include ColorValidator include ColorValidator

View File

@ -1,14 +1,11 @@
require_relative '../constants' require_relative '../constants'
require_relative 'arg_loader' require_relative 'arg_loader'
module Squib module Squib::Args
# @api private
module Args
class Paragraph class Paragraph
include ArgLoader include ArgLoader
def self.parameters def self.parameters
{ align: :left, { align: :left,
str: 'Hello, World!', str: 'Hello, World!',
@ -42,7 +39,7 @@ module Squib
def validate_font(arg, _i) def validate_font(arg, _i)
arg = @deck_font if arg == :use_set arg = @deck_font if arg == :use_set
arg = DEFAULT_FONT if arg == :default arg = Squib::DEFAULT_FONT if arg == :default
arg arg
end end
@ -115,4 +112,3 @@ module Squib
end end
end end
end

View File

@ -1,9 +1,7 @@
require_relative 'arg_loader' require_relative 'arg_loader'
require_relative 'dir_validator' require_relative 'dir_validator'
module Squib module Squib::Args
# @api private
module Args
class SaveBatch class SaveBatch
include ArgLoader include ArgLoader
include DirValidator include DirValidator
@ -60,4 +58,3 @@ module Squib
end end
end end
end

View File

@ -1,8 +1,6 @@
require_relative 'arg_loader' require_relative 'arg_loader'
module Squib module Squib::Args
# @api private
module Args
class SprueFile class SprueFile
include ArgLoader include ArgLoader
@ -41,4 +39,3 @@ module Squib
end end
end end
end end
end

View File

@ -1,13 +1,10 @@
require_relative '../constants' require_relative '../constants'
module Squib module Squib::Args
# @api private
module Args
# Internal class for handling arguments # Internal class for handling arguments
# @api private
class Typographer class Typographer
def initialize(config = Conf::DEFAULTS) def initialize(config = Squib::Conf::DEFAULTS)
%w(lsquote ldquote rsquote rdquote smart_quotes %w(lsquote ldquote rsquote rdquote smart_quotes
em_dash en_dash ellipsis).each do |var| em_dash en_dash ellipsis).each do |var|
instance_variable_set("@#{var}", config[var]) instance_variable_set("@#{var}", config[var])
@ -116,4 +113,3 @@ module Squib
end end
end end
end