Class: Computering::Dsl::Text
- Inherits:
-
Object
- Object
- Computering::Dsl::Text
show all
- Defined in:
- lib/computering/dsl/text.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(text, buffer = nil) ⇒ Text
Returns a new instance of Text.
11
12
13
14
|
# File 'lib/computering/dsl/text.rb', line 11
def initialize(text, buffer = nil)
@text = text
@buffer = buffer
end
|
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
9
10
11
|
# File 'lib/computering/dsl/text.rb', line 9
def text
@text
end
|
Class Method Details
.from_text(*text) ⇒ Object
3
4
5
6
7
|
# 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
|
Instance Method Details
#[](index) ⇒ Object
16
17
18
|
# File 'lib/computering/dsl/text.rb', line 16
def [](index)
text_with_style(@text[index], index) if @text[index]
end
|
#blank? ⇒ Boolean
31
32
33
|
# File 'lib/computering/dsl/text.rb', line 31
def blank?
@text.nil? || @text.strip == ""
end
|
#buffer ⇒ Object
27
28
29
|
# File 'lib/computering/dsl/text.rb', line 27
def buffer
add_style(@buffer, :buffer) if @buffer
end
|
#execute ⇒ Object
20
21
|
# File 'lib/computering/dsl/text.rb', line 20
def execute
end
|
#padding ⇒ Object
23
24
25
|
# File 'lib/computering/dsl/text.rb', line 23
def padding
" "
end
|