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 inherited from Object

#comment, #id

Instance Method Summary collapse

Methods inherited from Container

#<<

Methods inherited from Feature

add_author, #styles_to_kml, #timespan, #timespan=, #timestamp, #timestamp=

Constructor Details

#initialize(name = nil) ⇒ Folder

Returns a new instance of Folder.



671
672
673
674
675
676
677
# File 'lib/kamelopard/classes.rb', line 671

def initialize(name = nil)
    super()
    @name = name
    @styles = []
    @folders = []
    Document.instance.folders << self
end

Instance Attribute Details

#foldersObject

Returns the value of attribute folders.



669
670
671
# File 'lib/kamelopard/classes.rb', line 669

def folders
  @folders
end

#parent_folderObject

Returns the value of attribute parent_folder.



669
670
671
# File 'lib/kamelopard/classes.rb', line 669

def parent_folder
  @parent_folder
end

#stylesObject

Returns the value of attribute styles.



669
670
671
# File 'lib/kamelopard/classes.rb', line 669

def styles
  @styles
end

Instance Method Details

#has_parent?Boolean

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

Returns:

  • (Boolean)


693
694
695
# File 'lib/kamelopard/classes.rb', line 693

def has_parent?
    not @parent_folder.nil?
end

#to_kml(elem = nil) ⇒ Object



679
680
681
682
683
684
685
686
687
688
689
690
# File 'lib/kamelopard/classes.rb', line 679

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