Class: Hokusai::Outline

Inherits:
Struct
  • Object
show all
Defined in:
ui/src/hokusai/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bottomObject

Returns the value of attribute bottom

Returns:

  • (Object)

    the current value of bottom



50
51
52
# File 'ui/src/hokusai/types.rb', line 50

def bottom
  @bottom
end

#leftObject

Returns the value of attribute left

Returns:

  • (Object)

    the current value of left



50
51
52
# File 'ui/src/hokusai/types.rb', line 50

def left
  @left
end

#rightObject

Returns the value of attribute right

Returns:

  • (Object)

    the current value of right



50
51
52
# File 'ui/src/hokusai/types.rb', line 50

def right
  @right
end

#topObject

Returns the value of attribute top

Returns:

  • (Object)

    the current value of top



50
51
52
# File 'ui/src/hokusai/types.rb', line 50

def top
  @top
end

Class Method Details

.convert(value) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'ui/src/hokusai/types.rb', line 59

def self.convert(value)
  case value
  when String
    if value =~ /,/
      convert(value.split(",").map(&:to_f))
    else
      convert(value.to_f)
    end
  when Float
    new(value, value, value, value)
  when Array
    new(value[0] || 0.0, value[1] || 0.0, value[2] || 0.0, value[3] || 0.0)
  when Outline
    value
  end
end

.defaultObject



51
52
53
# File 'ui/src/hokusai/types.rb', line 51

def self.default
  new(0.0, 0.0, 0.0, 0.0)
end

Instance Method Details

#hashObject



55
56
57
# File 'ui/src/hokusai/types.rb', line 55

def hash
  [self.class, top, right, bottom, left].hash
end

#present?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'ui/src/hokusai/types.rb', line 76

def present?
  top > 0.0 || right > 0.0 || bottom > 0.0 || left > 0.0
end

#uniform?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'ui/src/hokusai/types.rb', line 80

def uniform?
  top == right && top == bottom && top == left
end