Class: VORuby::VOTables::VOTable::Data::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/votables/data.rb,
lib/voruby/votables/rexml_parser.rb,
lib/voruby/votables/libxml_parser.rb

Overview

A class representing a generic stream of data.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href = nil, expires = nil, rights = nil, type = Type::StreamType.new('locator'), actuate = Type::Actuate.new('onRequest'), encoding = Type::EncodingType.new('none')) ⇒ Stream

href:

The URL of the stream (type: Type::AnyURI).

expires:

The datetime on which the stream expires. Must be parsable by Ruby’s DateTime.parse() method.

rights:

The data rights associated with the stream.

type:

The type of stream (type: Type::StreamType).

actuate:

The actuate property of the stream (type: Type::Actuate).

encoding:

The encoding of the stream (type: Type::EncodingType).



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/voruby/votables/data.rb', line 24

def initialize(href=nil, expires=nil, rights=nil, type=Type::StreamType.new('locator'),
 	actuate=Type::Actuate.new('onRequest'),
 	encoding=Type::EncodingType.new('none'))
	
Misc::TypeCheck.new(type, Type::StreamType).check()
@type = type
	
Misc::TypeCheck.new(href, Type::AnyURI).check()
@href = href
	
Misc::TypeCheck.new(actuate, Type::Actuate).check()
@actuate = actuate
	
Misc::TypeCheck.new(encoding, Type::EncodingType).check()
@encoding = encoding
				
if expires
  @expires = DateTime.parse(expires)
else
 @expires = nil
end
	
@rights = rights
end

Instance Attribute Details

#actuateObject (readonly)

Returns the value of attribute actuate.



9
10
11
# File 'lib/voruby/votables/data.rb', line 9

def actuate
  @actuate
end

#encodingObject (readonly)

Returns the value of attribute encoding.



9
10
11
# File 'lib/voruby/votables/data.rb', line 9

def encoding
  @encoding
end

#expiresObject (readonly)

Returns the value of attribute expires.



9
10
11
# File 'lib/voruby/votables/data.rb', line 9

def expires
  @expires
end

#hrefObject (readonly)

Returns the value of attribute href.



9
10
11
# File 'lib/voruby/votables/data.rb', line 9

def href
  @href
end

#rightsObject (readonly)

Returns the value of attribute rights.



9
10
11
# File 'lib/voruby/votables/data.rb', line 9

def rights
  @rights
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/voruby/votables/data.rb', line 9

def type
  @type
end

Class Method Details

.from_xml(node) ⇒ Object



325
326
327
328
329
330
331
332
333
334
# File 'lib/voruby/votables/rexml_parser.rb', line 325

def self.from_xml(node)
href = Type::AnyURI.new(node.attributes['href']) if node.attributes['href']
expires = DateTime.parse(node.attributes['expires']) if node.attributes['expires']
rights = node.attributes['rights']
type = Type::StreamType.new(node.attributes['type']) if node.attributes['type']
actuate = Type::Actuate.new(node.attributes['actuate']) if node.attributes['actuate']
encoding = Type::EncodingType.new(node.attributes['encoding']) if node.attributes['encoding']
	
return self.new(href, expires, rights, type, actuate, encoding)
end

Instance Method Details

#to_sObject



49
50
51
52
# File 'lib/voruby/votables/data.rb', line 49

def to_s
"{type=#{@type};href=#{@href};actuate=#{@actuate};encoding=#{encoding};" +
"expires=#{@expires};rights=#{@rights}}"
end