|
|
|
@ -2,17 +2,17 @@ require_relative '../constants' |
|
|
|
require_relative '../conf' |
|
|
|
require_relative '../conf' |
|
|
|
require 'ostruct' |
|
|
|
require 'ostruct' |
|
|
|
|
|
|
|
|
|
|
|
module Squib |
|
|
|
# Intended to be used a a mix-in, |
|
|
|
# @api private |
|
|
|
# For example use see Box as an example |
|
|
|
module Args |
|
|
|
module Squib::Args::ArgLoader |
|
|
|
|
|
|
|
|
|
|
|
# Intended to be used a a mix-in, |
|
|
|
# wrapper for compatibility |
|
|
|
# For example use see Box as an example |
|
|
|
def extract!(args, deck) |
|
|
|
module ArgLoader |
|
|
|
load!(args, expand_by: deck.size, layout: deck.layout, dpi: deck.dpi) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
# Main class invoked by the client (i.e. api/ methods) |
|
|
|
# Main class invoked by the client (i.e. api/ methods) |
|
|
|
def load!(args, expand_by: 1, layout: {}, dpi: 300) |
|
|
|
def load!(args, expand_by: 1, layout: {}, dpi: 300) |
|
|
|
Squib.logger.debug { "ARG LOADER: load! for #{self.class}, args: #{args}" } |
|
|
|
|
|
|
|
@dpi = dpi |
|
|
|
@dpi = dpi |
|
|
|
args[:layout] = prep_layout_args(args[:layout], expand_by: expand_by) |
|
|
|
args[:layout] = prep_layout_args(args[:layout], expand_by: expand_by) |
|
|
|
expand_and_set_and_defaultify(args: args, by: expand_by, layout: layout) |
|
|
|
expand_and_set_and_defaultify(args: args, by: expand_by, layout: layout) |
|
|
|
@ -111,16 +111,13 @@ module Squib |
|
|
|
p_str = "@#{p}" |
|
|
|
p_str = "@#{p}" |
|
|
|
p_val = instance_variable_get(p_str) |
|
|
|
p_val = instance_variable_get(p_str) |
|
|
|
if p_val.respond_to? :each |
|
|
|
if p_val.respond_to? :each |
|
|
|
arr = p_val.map { |x| UnitConversion.parse(x, dpi) } |
|
|
|
arr = p_val.map { |x| Squib::Args::UnitConversion.parse(x, dpi) } |
|
|
|
instance_variable_set p_str, arr |
|
|
|
instance_variable_set p_str, arr |
|
|
|
else |
|
|
|
else |
|
|
|
instance_variable_set p_str, UnitConversion.parse(p_val, dpi) |
|
|
|
instance_variable_set p_str, Squib::Args::UnitConversion.parse(p_val, dpi) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
self |
|
|
|
self |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|