Browse Source

cleanup module definitions

dev
Andy Meneely 6 years ago
parent
commit
21bee3a3cb
  1. 7
      lib/squib/args/color_validator.rb
  2. 8
      lib/squib/args/coords.rb
  3. 5
      lib/squib/args/csv_opts.rb
  4. 7
      lib/squib/args/dir_validator.rb
  5. 5
      lib/squib/args/embed_adjust.rb
  6. 7
      lib/squib/args/embed_key.rb
  7. 5
      lib/squib/args/hand_special.rb
  8. 5
      lib/squib/args/import.rb
  9. 1
      lib/squib/args/paint.rb
  10. 8
      lib/squib/args/paragraph.rb
  11. 5
      lib/squib/args/save_batch.rb
  12. 5
      lib/squib/args/sprue_file.rb
  13. 8
      lib/squib/args/typographer.rb

7
lib/squib/args/color_validator.rb

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

8
lib/squib/args/coords.rb

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

5
lib/squib/args/csv_opts.rb

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

7
lib/squib/args/dir_validator.rb

@ -1,7 +1,4 @@
module Squib
# @api private
module Args
module DirValidator
module Squib::Args::DirValidator
def ensure_dir_created(dir)
unless Dir.exists?(dir)
@ -11,6 +8,4 @@ module Squib
return dir
end
end
end
end

5
lib/squib/args/embed_adjust.rb

@ -1,8 +1,6 @@
require_relative 'arg_loader'
module Squib
# @api private
module Args
module Squib::Args
class EmbedAdjust
include ArgLoader
@ -21,5 +19,4 @@ module Squib
end
end
end

7
lib/squib/args/embed_key.rb

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

5
lib/squib/args/hand_special.rb

@ -1,8 +1,6 @@
require 'cairo'
module Squib
# @api private
module Args
module Squib::Args
class HandSpecial
include ArgLoader
@ -33,5 +31,4 @@ module Squib
end
end
end

5
lib/squib/args/import.rb

@ -1,8 +1,6 @@
require_relative 'arg_loader'
module Squib
# @api private
module Args
module Squib::Args
class Import
include ArgLoader
@ -36,5 +34,4 @@ module Squib
end
end
end

1
lib/squib/args/paint.rb

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

8
lib/squib/args/paragraph.rb

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

5
lib/squib/args/save_batch.rb

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

5
lib/squib/args/sprue_file.rb

@ -1,8 +1,6 @@
require_relative 'arg_loader'
module Squib
# @api private
module Args
module Squib::Args
class SprueFile
include ArgLoader
@ -40,5 +38,4 @@ module Squib
"#{File.dirname(__FILE__)}/../builtin/sprues/#{file}"
end
end
end
end

8
lib/squib/args/typographer.rb

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

Loading…
Cancel
Save