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 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

8
lib/squib/args/coords.rb

@ -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

5
lib/squib/args/csv_opts.rb

@ -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

7
lib/squib/args/dir_validator.rb

@ -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

5
lib/squib/args/embed_adjust.rb

@ -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

7
lib/squib/args/embed_key.rb

@ -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

5
lib/squib/args/hand_special.rb

@ -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

5
lib/squib/args/import.rb

@ -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

1
lib/squib/args/paint.rb

@ -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

8
lib/squib/args/paragraph.rb

@ -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

5
lib/squib/args/save_batch.rb

@ -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

5
lib/squib/args/sprue_file.rb

@ -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

8
lib/squib/args/typographer.rb

@ -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

Loading…
Cancel
Save