Class: Computering::Dsl::Text
- Inherits:
-
Object
- Object
- Computering::Dsl::Text
- Defined in:
- lib/computering/dsl/text.rb
Class Method Summary collapse
Instance Method Summary collapse
- #[](index) ⇒ Object
- #blank? ⇒ Boolean
- #buffer ⇒ Object
- #execute ⇒ Object
-
#initialize(text) ⇒ Text
constructor
A new instance of Text.
Constructor Details
#initialize(text) ⇒ Text
Returns a new instance of Text.
3 4 5 6 |
# File 'lib/computering/dsl/text.rb', line 3 def initialize(text) @text = text @buffer = "" end |
Class Method Details
.from_text(text) ⇒ Object
23 24 25 |
# File 'lib/computering/dsl/text.rb', line 23 def self.from_text(text) text.strip.split("\n").map { |line| self.new(line) } end |
Instance Method Details
#[](index) ⇒ Object
8 9 10 |
# File 'lib/computering/dsl/text.rb', line 8 def [](index) @text[index] end |
#blank? ⇒ Boolean
19 20 21 |
# File 'lib/computering/dsl/text.rb', line 19 def blank? @text.nil? || @text.strip == "" end |
#buffer ⇒ Object
15 16 17 |
# File 'lib/computering/dsl/text.rb', line 15 def buffer @buffer end |
#execute ⇒ Object
12 13 |
# File 'lib/computering/dsl/text.rb', line 12 def execute end |