Class: Squid::Gridline

Inherits:
Object
  • Object
show all
Defined in:
lib/squid/gridline.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(y:) ⇒ Gridline

Returns a new instance of Gridline.



12
13
14
# File 'lib/squid/gridline.rb', line 12

def initialize(y:)
  @y = y
end

Instance Attribute Details

#yObject (readonly)

Returns the value of attribute y.



10
11
12
# File 'lib/squid/gridline.rb', line 10

def y
  @y
end

Class Method Details

.for(count:, skip_baseline:, height:) ⇒ Object



3
4
5
6
7
8
# File 'lib/squid/gridline.rb', line 3

def self.for(count:, skip_baseline:, height:)
  return [] if count.zero?
  height.step(0, -height/count.to_f).map do |y|
    new y: y unless skip_baseline && y.zero?
  end.compact
end