Class: Megar::Folder

Inherits:
Object
  • Object
show all
Includes:
CatalogItem
Defined in:
lib/megar/catalog/folder.rb

Overview

Folder collection item

Instance Attribute Summary

Attributes included from CatalogItem

#id, #key, #name, #payload, #type

Instance Method Summary collapse

Methods included from CatalogItem

#==, #[], #attributes=, #collection, #each, #find_by_type, #reset!, #resource_class

Constructor Details

#initialize(attributes = {}) ⇒ Folder

Override initialisation to set special-purpose names



15
16
17
18
# File 'lib/megar/catalog/folder.rb', line 15

def initialize(attributes={})
  super
  self.name = nil unless name
end

Instance Method Details

#name=(value) ⇒ Object

Name assignment with special-purpose name support



6
7
8
9
10
11
12
# File 'lib/megar/catalog/folder.rb', line 6

def name=(value)
  @name = if "#{value}" != ""
    value
  elsif type.is_a?(Fixnum)
    ["Cloud Drive","Inbox","Trash Bin"][type-2]
  end
end