Class: Collada::Parser::Reference

Inherits:
Object
  • Object
show all
Defined in:
lib/collada/parser/support.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind, url) ⇒ Reference

Returns a new instance of Reference.



82
83
84
85
# File 'lib/collada/parser/support.rb', line 82

def initialize(kind, url)
	@kind = kind
	@url = url
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



87
88
89
# File 'lib/collada/parser/support.rb', line 87

def kind
  @kind
end

#urlObject (readonly)

Returns the value of attribute url.



88
89
90
# File 'lib/collada/parser/support.rb', line 88

def url
  @url
end

Instance Method Details

#idObject



90
91
92
# File 'lib/collada/parser/support.rb', line 90

def id
	url.sub(/^.*\#/, '')
end

#lookup(library) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/collada/parser/support.rb', line 94

def lookup(library)
	library[@kind].each do |item|
		return item if item.id == id
	end
	
	return nil
end

#to_sObject



102
103
104
# File 'lib/collada/parser/support.rb', line 102

def to_s
	"\#<#{self.class} #{@url.dump} in #{@kind}>"
end