Class: MindmeisterApi::ZipContentList
- Inherits:
-
Object
- Object
- MindmeisterApi::ZipContentList
- Defined in:
- lib/mindmeister_api/zip_helpers/zip_content_list.rb
Overview
ZIP helper
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Instance Method Summary collapse
- #add(name, content) ⇒ Object
- #find(name) ⇒ Object
- #find_content(name) ⇒ Object
-
#initialize ⇒ ZipContentList
constructor
A new instance of ZipContentList.
Constructor Details
#initialize ⇒ ZipContentList
Returns a new instance of ZipContentList.
8 9 10 |
# File 'lib/mindmeister_api/zip_helpers/zip_content_list.rb', line 8 def initialize @list = [] end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
6 7 8 |
# File 'lib/mindmeister_api/zip_helpers/zip_content_list.rb', line 6 def list @list end |
Instance Method Details
#add(name, content) ⇒ Object
12 13 14 |
# File 'lib/mindmeister_api/zip_helpers/zip_content_list.rb', line 12 def add(name, content) @list << OpenStruct.new(name: name, content: content) end |
#find(name) ⇒ Object
16 17 18 |
# File 'lib/mindmeister_api/zip_helpers/zip_content_list.rb', line 16 def find(name) @list.find { |item| item.name == name } end |
#find_content(name) ⇒ Object
20 21 22 23 24 |
# File 'lib/mindmeister_api/zip_helpers/zip_content_list.rb', line 20 def find_content(name) item = find(name) item.nil? ? nil : item.content end |