Class: PMLCode::Content
- Inherits:
-
Object
- Object
- PMLCode::Content
- Includes:
- Enumerable
- Defined in:
- lib/pmlcode/content.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #has_part?(name) ⇒ Boolean
-
#initialize(lines) ⇒ Content
constructor
A new instance of Content.
- #to_s ⇒ Object
Constructor Details
#initialize(lines) ⇒ Content
Returns a new instance of Content.
9 10 11 |
# File 'lib/pmlcode/content.rb', line 9 def initialize(lines) @lines = lines end |
Class Method Details
.parse(text) ⇒ Object
4 5 6 7 |
# File 'lib/pmlcode/content.rb', line 4 def self.parse(text) parser = Parser.new(text) new(parser.result) end |
Instance Method Details
#each(&block) ⇒ Object
17 18 19 |
# File 'lib/pmlcode/content.rb', line 17 def each(&block) @lines.each(&block) end |
#has_part?(name) ⇒ Boolean
13 14 15 |
# File 'lib/pmlcode/content.rb', line 13 def has_part?(name) @lines.any? { |l| l.in_part?(name) } end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/pmlcode/content.rb', line 21 def to_s @lines.map(&:text) end |