Class: OMF::Web::Server::JSONDataSource
- Inherits:
-
Base::LObject
- Object
- Base::LObject
- OMF::Web::Server::JSONDataSource
- Defined in:
- lib/omf-web/thin/server.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ JSONDataSource
constructor
A new instance of JSONDataSource.
- #offset ⇒ Object
- #on_content_changed(*args) ⇒ Object
-
#rows ⇒ Object
-
rows Returns an array of rows * on_content_changed(lambdarows) Call provided block with actions :added, :removed * create_sliced_table (optional) * release Not exactly sure when that is being used * schema Schema of row * offset.
-
- #schema ⇒ Object
Constructor Details
#initialize(file) ⇒ JSONDataSource
Returns a new instance of JSONDataSource.
414 415 416 417 |
# File 'lib/omf-web/thin/server.rb', line 414 def initialize(file) raw = File.read(file) @content = [[JSON.parse(raw)]] end |
Instance Method Details
#offset ⇒ Object
429 430 431 |
# File 'lib/omf-web/thin/server.rb', line 429 def offset 0 end |
#on_content_changed(*args) ⇒ Object
438 439 440 |
# File 'lib/omf-web/thin/server.rb', line 438 def on_content_changed(*args) # do nothing end |
#rows ⇒ Object
-
rows Returns an array of rows
-
on_content_changed(lambdarows) Call provided block with actions :added, :removed
-
create_sliced_table (optional)
-
release Not exactly sure when that is being used
-
schema Schema of row
-
offset
425 426 427 |
# File 'lib/omf-web/thin/server.rb', line 425 def rows @content end |
#schema ⇒ Object
433 434 435 436 |
# File 'lib/omf-web/thin/server.rb', line 433 def schema require 'omf_oml/schema' OMF::OML::OmlSchema.create([[:content]]) end |