Class: Squib::Gap

Inherits:
Object
  • Object
show all
Defined in:
lib/squib/commands/data/template_option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition) ⇒ Gap

Returns a new instance of Gap



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/squib/commands/data/template_option.rb', line 55

def initialize(definition)
  if definition.instance_of? String
    @horizontal, @vertical = expand_shorthand(
      definition.split(/\s+/).map!(&:to_f))
  elsif definition.instance_of? Array
    @horizontal, @vertical = expand_shorthand definition
  elsif definition.is_a? Numeric
    @horizontal, @vertical = definition, definition
  else
    raise ArgumentError, 'Invalid value, must be either string or array'
  end
end

Instance Attribute Details

#horizontalObject (readonly)



52
53
54
# File 'lib/squib/commands/data/template_option.rb', line 52

def horizontal
  @horizontal
end

#verticalObject (readonly)



53
54
55
# File 'lib/squib/commands/data/template_option.rb', line 53

def vertical
  @vertical
end