Module: Vizcore::Shape::ClassMethods
- Defined in:
- lib/vizcore/shape.rb
Overview
Class methods added to custom shape classes.
Instance Method Summary collapse
- #param(name, default: nil, range: nil, min: nil, max: nil, step: nil) ⇒ Object
- #shape_param_schema ⇒ Object
Instance Method Details
#param(name, default: nil, range: nil, min: nil, max: nil, step: nil) ⇒ Object
181 182 183 184 185 186 187 188 189 190 |
# File 'lib/vizcore/shape.rb', line 181 def param(name, default: nil, range: nil, min: nil, max: nil, step: nil) key = name.to_sym range_min, range_max = range_values(range) = { name: key } [:default] = default unless default.nil? [:min] = min.nil? ? range_min : min [:max] = max.nil? ? range_max : max [:step] = step unless step.nil? shape_param_schema[key] = .compact end |
#shape_param_schema ⇒ Object
192 193 194 |
# File 'lib/vizcore/shape.rb', line 192 def shape_param_schema @shape_param_schema ||= {} end |