Class: OMF::Web::Server::JSONDataSource

Inherits:
Base::LObject
  • Object
show all
Defined in:
lib/omf-web/thin/server.rb

Instance Method Summary collapse

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

#offsetObject



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

#rowsObject

  • 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

#schemaObject



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