Class: Kamelopard::StyleSelector

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

Overview

Abstract class corresponding to KML’s StyleSelector object.

Direct Known Subclasses

Style, StyleMap

Instance Attribute Summary

Attributes inherited from Object

#comment, #kml_id, #master_only

Instance Method Summary collapse

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, parse

Constructor Details

#initialize(options = {}) ⇒ StyleSelector

Returns a new instance of StyleSelector.



1609
1610
1611
1612
1613
# File 'lib/kamelopard/classes.rb', line 1609

def initialize(options = {})
    super
    @attached = false
    DocumentHolder.instance.current_document.styles << self
end

Instance Method Details

#attach(obj) ⇒ Object



1619
1620
1621
1622
# File 'lib/kamelopard/classes.rb', line 1619

def attach(obj)
    @attached = true
    obj.styles << self
end

#attached?Boolean

Returns:

  • (Boolean)


1615
1616
1617
# File 'lib/kamelopard/classes.rb', line 1615

def attached?
    @attached
end

#to_kml(elem = nil) ⇒ Object



1624
1625
1626
1627
1628
# File 'lib/kamelopard/classes.rb', line 1624

def to_kml(elem = nil)
    elem = XML::Node.new 'StyleSelector' if elem.nil?
    super elem
    elem
end