Sha256: 9c638f06db37a8cd102efc03f4257dc0b357afa9f5c1c34b15906625d6d25487
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module Vedeu class Geometry def initialize(values = {}) @values = values || {} end def origin(index = 0) Position.set(vy(index), vx) end def y values[:y] end def x values[:x] end def width values[:width] end def height values[:height] end def dy clip_y? ? defaults[:height] : (y + height) end def dx clip_x? ? defaults[:width] : (x + width) end def vx(index = 0) # virtual x position ((x..dx).to_a)[index] end def vy(index = 0) # virtual y position ((y..dy).to_a)[index] end private def clip_y? ((y + height) > defaults[:height]) end def clip_x? ((x + width) > defaults[:width]) end def values defaults.merge!(auto) end def auto @values.delete_if { |k, v| k == :width && v == :auto } @values.delete_if { |k, v| k == :height && v == :auto } end def defaults { width: Terminal.width, height: Terminal.height, y: 1, x: 1 } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.25 | lib/vedeu/output/geometry.rb |