Class: MindmeisterApi::ZipContentList

Inherits:
Object
  • Object
show all
Defined in:
lib/mindmeister_api/zip_helpers/zip_content_list.rb

Overview

ZIP helper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeZipContentList

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

#listObject (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