Browse Source
As a rule, I think it's better to group args classes together have some extra overhead of extracting unused parameters. For example, we don't *need* to extract "n" for the circle, but the ease of having logically grouped classes is better than having tons of different classes tailored to each command.dev
4 changed files with 24 additions and 75 deletions
@ -1,26 +0,0 @@
|
||||
require 'squib/args/arg_loader' |
||||
|
||||
module Squib |
||||
# @api private |
||||
module Args |
||||
|
||||
class Polygon |
||||
include ArgLoader |
||||
|
||||
def self.parameters |
||||
{ x: 0, y: 0, n: 5, |
||||
radius: 100, inner_radius: 50, outer_radius: 100} |
||||
end |
||||
|
||||
def self.expanding_parameters |
||||
parameters.keys # all of them |
||||
end |
||||
|
||||
def self.params_with_units |
||||
parameters.keys # all of them |
||||
end |
||||
|
||||
end |
||||
|
||||
end |
||||
end |
||||
@ -1,27 +0,0 @@
|
||||
require 'squib/args/arg_loader' |
||||
|
||||
module Squib |
||||
# @api private |
||||
module Args |
||||
|
||||
class Tri |
||||
include ArgLoader |
||||
|
||||
def self.parameters |
||||
{ x1: 100, y1: 100, |
||||
x2: 150, y2: 150, |
||||
x3: 100, y3: 150 } |
||||
end |
||||
|
||||
def self.expanding_parameters |
||||
parameters.keys # all of them |
||||
end |
||||
|
||||
def self.params_with_units |
||||
parameters.keys # all of them |
||||
end |
||||
|
||||
end |
||||
|
||||
end |
||||
end |
||||
Loading…
Reference in new issue