spec/helpers/objection_classes.rb in motion-objection-0.6.3 vs spec/helpers/objection_classes.rb in motion-objection-0.6.4

- old
+ new

@@ -1,12 +1,22 @@ class Car - include Objection - compose_with :engine, :brakes, factory: JSObjectFactory + include Objection::Compose + compose_with :engine, :brakes, factory: JSObjectFactory end +class EagerCar + include Objection::Compose + singleton + class<<self; attr_accessor :awoke; end + + def awakeFromObjection + self.class.awoke = true + end +end + class Engine - include Objection + include Objection::Compose singleton compose_with 'engine/crank_shaft', 'engine/rod' def shift(wat) puts "SHIFT!" @@ -17,11 +27,13 @@ class Rod end end -class V6Engine < Engine; end +class V6Engine < Engine + compose_with factory: JSObjectFactory +end class Brakes def brake! end end @@ -30,10 +42,10 @@ def abs_brake! end end class ViewController < NSObject - include Objection + include Objection::Compose initializer "initWithNibName:bundle:", "Home" attr_reader :name def initWithNibName(name, bundle: bundle)