Class: Manceps::ResourceContents
- Inherits:
-
Object
- Object
- Manceps::ResourceContents
- Defined in:
- lib/manceps/resource_contents.rb
Overview
Contents returned from a resource read.
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
Instance Method Summary collapse
-
#initialize(data) ⇒ ResourceContents
constructor
A new instance of ResourceContents.
- #text ⇒ Object
Constructor Details
#initialize(data) ⇒ ResourceContents
Returns a new instance of ResourceContents.
8 9 10 |
# File 'lib/manceps/resource_contents.rb', line 8 def initialize(data) @contents = (data['contents'] || []).map { |c| Content.new(c) } end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
6 7 8 |
# File 'lib/manceps/resource_contents.rb', line 6 def contents @contents end |
Instance Method Details
#text ⇒ Object
12 13 14 |
# File 'lib/manceps/resource_contents.rb', line 12 def text contents.select(&:text?).map(&:text).join("\n") end |