Class: Trinity::Resource
- Inherits:
-
Object
- Object
- Trinity::Resource
- Includes:
- RDF::Enumerable
- Defined in:
- lib/trinity/resource.rb
Instance Attribute Summary
- - (Object) data readonly Returns the value of attribute data.
- - (Object) url readonly Returns the value of attribute url.
Instance Method Summary
- - (Object) each(&block)
- - (Boolean) found?
- - (Resource) initialize(url, data = []) constructor A new instance of Resource.
- - (Object) render(env)
Constructor Details
- (Resource) initialize(url, data = [])
A new instance of Resource
9 10 11 |
# File 'lib/trinity/resource.rb', line 9 def initialize(url, data = []) @url, @data = RDF::URI.new(url.to_s), data end |
Instance Attribute Details
- (Object) data (readonly)
Returns the value of attribute data
7 8 9 |
# File 'lib/trinity/resource.rb', line 7 def data @data end |
- (Object) url (readonly)
Returns the value of attribute url
6 7 8 |
# File 'lib/trinity/resource.rb', line 6 def url @url end |
Instance Method Details
- (Object) each(&block)
17 18 19 |
# File 'lib/trinity/resource.rb', line 17 def each(&block) data.each(&block) end |
- (Boolean) found?
13 14 15 |
# File 'lib/trinity/resource.rb', line 13 def found? !empty? end |
- (Object) render(env)
21 22 23 |
# File 'lib/trinity/resource.rb', line 21 def render(env) Renderer.for(env).new(env).render(self) end |