Class: VORuby::STC::V1_10::STC::RegionFileType

Inherits:
SpatialIntervalType show all
Defined in:
lib/voruby/stc/1.10/stc.rb

Overview

Points to a Region file

Direct Known Subclasses

RegionFile

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ RegionFileType

Returns a new instance of RegionFileType.



2274
2275
2276
2277
# File 'lib/voruby/stc/1.10/stc.rb', line 2274

def initialize(options={})
  raise_argument_required_error('file') if !options.has_key?(:file)
  super(options)
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



2272
2273
2274
# File 'lib/voruby/stc/1.10/stc.rb', line 2272

def file
  @file
end

Class Method Details

.from_xml(xml) ⇒ Object



2298
2299
2300
2301
2302
2303
2304
2305
2306
# File 'lib/voruby/stc/1.10/stc.rb', line 2298

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :file => URI.parse(REXML::XPath.first(root, 'x:File', {'x' => obj_ns.uri}).text)
  }
  
  self.new(options)
end

Instance Method Details

#==(f) ⇒ Object



2284
2285
2286
# File 'lib/voruby/stc/1.10/stc.rb', line 2284

def ==(f)
  self.file == f.file
end

#to_xml(name = nil) ⇒ Object



2288
2289
2290
2291
2292
2293
2294
2295
2296
# File 'lib/voruby/stc/1.10/stc.rb', line 2288

def to_xml(name=nil)
  el = element(name)
  
  file = REXML::Element.new("#{obj_ns.prefix}:File")
  file.text = self.file.to_s
  el.add_element(file)
  
  el
end