lib/squib/args/sheet.rb in squib-0.13.4 vs lib/squib/args/sheet.rb in squib-0.14.beta1
- old
+ new
@@ -38,10 +38,12 @@
rows: :infinite,
columns: 5,
trim_radius: 38,
trim: 0,
width: 3300,
+ range: :all,
+ rtl: false,
}
end
def self.expanding_parameters
[] # none of them
@@ -77,12 +79,17 @@
arg.to_i
end
def validate_rows(arg)
raise 'columns must be an integer' unless columns.respond_to? :to_i
- return 1 if @deck_size < columns
+ count = if range == :all
+ @deck_size
+ else
+ count = range.to_a.length
+ end
+ return 1 if count <= columns
return arg if arg.respond_to? :to_i
- (@deck_size.to_i / columns.to_i).ceil
+ (count.to_f / columns.to_f).ceil
end
def full_filename
"#{dir}/#{file}"
end