Class: Vedeu::TextAdaptor
- Inherits:
-
Object
- Object
- Vedeu::TextAdaptor
- Defined in:
- lib/vedeu/parsing/text_adaptor.rb
Class Method Summary collapse
-
.adapt(text) ⇒ Array
Convert a block of text into a collection of lines.
Instance Method Summary collapse
- #adapt ⇒ Object
-
#initialize(text) ⇒ TextAdaptor
constructor
A new instance of TextAdaptor.
Constructor Details
#initialize(text) ⇒ TextAdaptor
Returns a new instance of TextAdaptor.
13 14 15 |
# File 'lib/vedeu/parsing/text_adaptor.rb', line 13 def initialize(text) @text = text end |
Class Method Details
.adapt(text) ⇒ Array
Convert a block of text into a collection of lines.
9 10 11 |
# File 'lib/vedeu/parsing/text_adaptor.rb', line 9 def self.adapt(text) new(text).adapt end |
Instance Method Details
#adapt ⇒ Object
17 18 19 20 21 |
# File 'lib/vedeu/parsing/text_adaptor.rb', line 17 def adapt return [] if no_content? lines.map { |line| { streams: { text: line } } } end |