Class: RubyRest::Resource::Sequel

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyrest/resource.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#app, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

atom, link, links, mount_point, mutable_props, props, related, related_resources, #resource, #to_s, with_mount_point, with_mutable_props

Constructor Details

#initialize(app, name) ⇒ Sequel

Creates a new resource, under the given application



87
88
89
90
# File 'lib/rubyrest/resource.rb', line 87

def initialize( app, name )
  super( app, name )
  @dataset = app.db[self.class.table_name]
end

Instance Attribute Details

#datasetObject (readonly)

Returns the value of attribute dataset.



84
85
86
# File 'lib/rubyrest/resource.rb', line 84

def dataset
  @dataset
end

Class Method Details

.table_nameObject



101
102
103
# File 'lib/rubyrest/resource.rb', line 101

def self.table_name
  @table_name
end

.with_table_name(table_name) ⇒ Object



97
98
99
# File 'lib/rubyrest/resource.rb', line 97

def self.with_table_name table_name
  @table_name = table_name
end

Instance Method Details

#table(name) ⇒ Object

Provides access to an arbitrary table



93
94
95
# File 'lib/rubyrest/resource.rb', line 93

def table( name )
  app.db[name]
end