Class: Kamelopard::Folder

Inherits:
Container show all
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to KML’s Folder object.

Instance Attribute Summary collapse

Attributes inherited from Feature

#abstractView, #addressDetails, #atom_author, #atom_link, #description, #extendedData, #metadata, #name, #open, #phoneNumber, #region, #snippet, #styleSelector, #styleUrl, #timeprimitive, #visibility

Attributes included from Snippet

#maxLines, #snippet_text

Attributes inherited from Object

#comment, #kml_id, #master_only

Instance Method Summary collapse

Methods inherited from Container

#<<, #features=

Methods inherited from Feature

add_author, #extended_data_to_kml, #hide, #show, #styles_to_kml, #timespan, #timespan=, #timestamp, #timestamp=

Methods included from Snippet

#snippet_to_kml

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, parse

Constructor Details

#initialize(name = nil, options = {}) ⇒ Folder

Returns a new instance of Folder.



1050
1051
1052
1053
1054
1055
# File 'lib/kamelopard/classes.rb', line 1050

def initialize(name = nil, options = {})
    @styles = []
    @folders = []
    super
    DocumentHolder.instance.current_document.folders << self
end

Instance Attribute Details

#foldersObject

Returns the value of attribute folders.



1048
1049
1050
# File 'lib/kamelopard/classes.rb', line 1048

def folders
  @folders
end

#parent_folderObject

Returns the value of attribute parent_folder.



1048
1049
1050
# File 'lib/kamelopard/classes.rb', line 1048

def parent_folder
  @parent_folder
end

#stylesObject

Returns the value of attribute styles.



1048
1049
1050
# File 'lib/kamelopard/classes.rb', line 1048

def styles
  @styles
end

Instance Method Details

#has_parent?Boolean

Folders can have parent folders; returns true if this folder has one

Returns:

  • (Boolean)


1087
1088
1089
# File 'lib/kamelopard/classes.rb', line 1087

def has_parent?
    not @parent_folder.nil?
end

#to_kml(elem = nil) ⇒ Object



1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
# File 'lib/kamelopard/classes.rb', line 1073

def to_kml(elem = nil)
    h = XML::Node.new 'Folder'
    super h
    @features.each do |a|
        a.to_kml(h)
    end
    @folders.each do |a|
        a.to_kml(h)
    end
    elem << h unless elem.nil?
    h
end