Class: CodeSync::Server::ServerInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/code_sync/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ ServerInfo

Returns a new instance of ServerInfo.



196
197
198
199
200
# File 'lib/code_sync/server.rb', line 196

def initialize app, options={}
  @sprockets  = options[:sprockets]
  @faye       = options[:faye]
  @options    = options.dup
end

Instance Attribute Details

#fayeObject

Returns the value of attribute faye.



194
195
196
# File 'lib/code_sync/server.rb', line 194

def faye
  @faye
end

#optionsObject

Returns the value of attribute options.



194
195
196
# File 'lib/code_sync/server.rb', line 194

def options
  @options
end

#sprocketsObject

Returns the value of attribute sprockets.



194
195
196
# File 'lib/code_sync/server.rb', line 194

def sprockets
  @sprockets
end

Instance Method Details

#allow_saving?Boolean

Returns:

  • (Boolean)


206
207
208
# File 'lib/code_sync/server.rb', line 206

def allow_saving?
  options[:allow_saving] == true
end

#call(env) ⇒ Object



210
211
212
213
# File 'lib/code_sync/server.rb', line 210

def call(env)
  response = JSON.generate(project_assets: sprockets.project_assets, codesync_version: CodeSync::Version,paths:sprockets.env.paths, root:@options[:root], allow_saving: allow_saving?)
  [200, {"Access-Control-Allow-Origin"=>"*","Content-Type" => "application/json"}, [response]]
end

#to_sObject



202
203
204
# File 'lib/code_sync/server.rb', line 202

def to_s
  "codesync server info"
end