Skip to content

Instantly share code, notes, and snippets.

private[this] def badParams(msg: String) = BadRequest(
Json.toJson(Map("error" -> ("Be sure to have these params defined: "+msg)))
)
def create = Action(parse.json) { request =>
(for (
modeStr <- (request.body \ "mode").asOpt[String];
mode <- Graph.ConnectionsMode.withNameOpt(modeStr);
time <- (request.body \ "travel_time").asOpt[Int];
lat <- (request.body \ "origin" \ "lat").asOpt[Double];
describe "planets|player_index" do
before(:each) do
@action = "planets|player_index"
@params = {}
end
it_behaves_like "only push"
it_should_behave_like "having controller action scope"
it "should return players planets" do
# Raise an exception in caller context, but stay running
def abort(cause)
cause = case cause
when String then RuntimeError.new(cause)
when Exception then cause
else raise "Unknown abort cause class #{cause.class} for object #{cause.inspect}"
end
raise AbortError.new(cause)
end
Server has encountered an error!
[2012-05-27 13:06:25.091|worker-world_0|worker-world_0|error] <Player(784), pop: 2629/2500(2735), gid: 1, name: "auris505", creds: 18229, VIP: 2@0/2150> unregister in dispatcher-88.222.193.60:60524 failed: Exception: undefined method `exception' for #<String:0x261f19> (exception)
Backtrace:
/home/spacegame/nebula-server/20120526143740/vendor/bundle/jruby/1.9/bundler/gems/celluloid-53b31cb209dd/lib/celluloid/responses.rb:20:in `value'
/home/spacegame/nebula-server/20120526143740/vendor/bundle/jruby/1.9/bundler/gems/celluloid-53b31cb209dd/lib/celluloid/actor.rb:59:in `call'
/home/spacegame/nebula-server/20120526143740/vendor/bundle/jruby/1.9/bundler/gems/celluloid-53b31cb209dd/lib/celluloid/actor_proxy.rb:80:in `method_missing'
/home/spacegame/nebula-server/20120526143740/lib/app/models/player.rb:497:in `_callback_after_746'
/home/spacegame/nebula-server/20120526143740/vendor/bundle/jruby/1.9/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:476:in `_run__1237543502__
Server has encountered an error!
[2012-05-21 03:28:28.524|dispatcher|main|error] Dispatcher: async call `push_to_player' aborted!
Celluloid::AbortError: caused by #<ArgumentError: Type signature mismatch!
* Expected variable 'player_id' to be Fixnum but it was NilClass (nil)>: Type signature mismatch!
* Expected variable 'player_id' to be Fixnum but it was NilClass (nil)
/home/spacegame/nebula-server/20120508112349/vendor/bundle/jruby/1.9/bundler/gems/celluloid-53b31cb209dd/lib/celluloid.rb:177:in `abort'
dummy:80:in `raise_to_abort'
val fire = L.block(
"Combatant "+combatant+" from alliance id "+allianceId+
" is shooting", level=L.Debug
) { () => shootGuns(allianceId, combatant) }
# Fake _target_ identity. This extends #is_a?, #kind_of?, #instance_of? on
# _target_ and #=== on _pretended_klass_.
#
# Example: fake_identity YourCustomHash, Hash
#
# @param [Class] target class that is being given fake identity
# @param [Class] pretended_klass class that target is pretending to be
def self.fake_identity(target, pretended_klass)
target.instance_eval do
[:is_a?, :kind_of?, :instance_of?].each do |method|
>> def a.===(o); puts o.inspect; true; end
=> nil
>> case a
>> when Hash then puts "woot"
>> end
=> nil
private def doubleOpt(key: String) = data.double(key) match {
case null => None
case x: Double => Some(x)
}
Combat.Runner.java_send(:run,
[
Java::spacemule.modules.combat.objects.Location,
Java::java.lang.Boolean,
Java::scala.Option,
org.jruby.runtime.builtin.IRubyObject,
org.jruby.RubyHash,
org.jruby.RubyHash,
org.jruby.runtime.builtin.IRubyObject,
org.jruby.RubyHash,