module Layouter
Constants
- VERSION
Public Class Methods
annotation(*args)
click to toggle source
# File lib/layouter.rb, line 24 def annotation(*args) Leaf::Annotation.new(*args) end
bordered(chars, *args, &block)
click to toggle source
# File lib/layouter.rb, line 46 def bordered(chars, *args, &block) rows( cols( literal(chars[:tl]), horizontal(chars[:t]), literal(chars[:tr]), ), cols( vertical(chars[:l]), custom(*args, &block), vertical(chars[:r]), ), cols( literal(chars[:bl]), horizontal(chars[:b]), literal(chars[:br]), ) ) end
cols(*children)
click to toggle source
# File lib/layouter.rb, line 16 def cols(*children) Parent.new(:cols, children) end
custom(*args, &block)
click to toggle source
# File lib/layouter.rb, line 32 def custom(*args, &block) Leaf::Custom.new(*args, &block) end
horizontal(char)
click to toggle source
# File lib/layouter.rb, line 36 def horizontal(char) raise(ArgumentError.new("Must pass single character")) if char.length != 1 custom(height: 1) { |w, h| char * w } end
literal(content)
click to toggle source
# File lib/layouter.rb, line 28 def literal(content) annotation(content, trim: false) end
rows(*children)
click to toggle source
# File lib/layouter.rb, line 12 def rows(*children) Parent.new(:rows, children) end
spacer(*args)
click to toggle source
# File lib/layouter.rb, line 20 def spacer(*args) Leaf::Spacer.new(*args) end
vertical(char)
click to toggle source
# File lib/layouter.rb, line 41 def vertical(char) raise(ArgumentError.new("Must pass single character")) if char.length != 1 custom(width: 1) { |w, h| ([char] * h).join("\n") } end