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.
261 262 263 264 |
# File 'lib/omf-web/thin/server.rb', line 261 def initialize(file) raw = File.read(file) @content = [[JSON.parse(raw)]] end |
Instance Method Details
#offset ⇒ Object
276 277 278 |
# File 'lib/omf-web/thin/server.rb', line 276 def offset 0 end |
#on_content_changed(*args) ⇒ Object
285 286 287 |
# File 'lib/omf-web/thin/server.rb', line 285 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
272 273 274 |
# File 'lib/omf-web/thin/server.rb', line 272 def rows @content end |
#schema ⇒ Object
280 281 282 283 |
# File 'lib/omf-web/thin/server.rb', line 280 def schema require 'omf_oml/schema' OMF::OML::OmlSchema.create([[:content]]) end |