Sha256: acd3d92af9dbd8db22affb3961524e87cc206712075334fcee2fde8b18ac89f2

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

require 'json'
require 'rack'
require 'thin'
require 'faye'
require 'sinatra'
require 'tilt'
require 'tilt/erb'

require "magic_mirror/version"
require "magic_mirror/mirror"
require "magic_mirror/command_cache"

module MagicMirror
  @@mirror = nil
  @@command_cache = CommandCache.new # unless @@command_cache

  def self.new(options = {})
    return @@mirror unless @@mirror.nil?
    @sinatra_root = options[:sinatra_root] ? options[:sinatra_root] : File.expand_path('../..', __FILE__)
    @@mirror = Mirror.new
    @@mirror.init_servers! if options[:init_servers]
    @@mirror
  end

  def self.mirror
    @@mirror
  end

  def self.sinatra_root=(value)
    @sinatra_root = value
  end

  def self.sinatra_root
    @sinatra_root
  end

  def self.command_cache
    # [ "RenderingCanvas.new('myCanvas', { title: 'trtl', minsize: [800, 600], is_test: true })",
    #   "RenderingcLine.new('myCanvas', 0, 0, 50, 50)"
    # ]
    @@command_cache
  end

  def self.command_cache=(value)
    @@command_cache=value
  end

end


# lol, hoisting problem in ruby???  thx sinatra...
require 'magic_mirror/sinatra_silver'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
magic_mirror-0.1.4 lib/magic_mirror.rb
magic_mirror-0.1.3 lib/magic_mirror.rb
magic_mirror-0.1.2 lib/magic_mirror.rb
magic_mirror-0.1.1 lib/magic_mirror.rb
magic_mirror-0.1.0 lib/magic_mirror.rb