class Computering::Dsl::Text

Attributes

text[R]

Public Class Methods

from_text(*text) click to toggle source
# File lib/computering/dsl/text.rb, line 3
def self.from_text(*text)
  text.flatten.map do |t|
    t.strip.split("\n").map { |line| self.new(line) }
  end.flatten
end
new(text, buffer = nil) click to toggle source
# File lib/computering/dsl/text.rb, line 11
def initialize(text, buffer = nil)
  @text   = text
  @buffer = buffer
end

Public Instance Methods

[](index) click to toggle source
# File lib/computering/dsl/text.rb, line 16
def [](index)
  text_with_style(@text[index], index) if @text[index]
end
blank?() click to toggle source
# File lib/computering/dsl/text.rb, line 31
def blank?
  @text.nil? || @text.strip == ""
end
buffer() click to toggle source
# File lib/computering/dsl/text.rb, line 27
def buffer
  add_style(@buffer, :buffer) if @buffer
end
execute() click to toggle source
# File lib/computering/dsl/text.rb, line 20
def execute
end
padding() click to toggle source
# File lib/computering/dsl/text.rb, line 23
def padding
  "   "
end

Protected Instance Methods

add_style(text, type) click to toggle source
# File lib/computering/dsl/text.rb, line 41
def add_style(text, type)
  id = self.class.name.split("::").last.downcase.to_sym
  Computering::Config.styling(text, id, type)
end
text_with_style(text, index) click to toggle source
# File lib/computering/dsl/text.rb, line 37
def text_with_style(text, index)
  add_style(text, :text)
end