Class: AngryMob::Target::Notify
- Defined in:
- lib/angry_mob/target/notify.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #call(mob) ⇒ Object
-
#initialize(act) ⇒ Notify
constructor
A new instance of Notify.
- #inject_actions(args) ⇒ Object
- #inspect ⇒ Object
- #method_missing(method, *args, &blk) ⇒ Object
- #nickname ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &blk) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/angry_mob/target/notify.rb', line 36 def method_missing(method,*args,&blk) if ! @target @target = method.to_s @args = AngryHash.__convert_without_dup( args.first ) if args.first end if method == :now raise "notify.now is no longer supported" else @actions << method.to_s end return self end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
4 5 6 |
# File 'lib/angry_mob/target/notify.rb', line 4 def actions @actions end |
#args ⇒ Object (readonly)
Returns the value of attribute args.
4 5 6 |
# File 'lib/angry_mob/target/notify.rb', line 4 def args @args end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
4 5 6 |
# File 'lib/angry_mob/target/notify.rb', line 4 def target @target end |
Instance Method Details
#call(mob) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/angry_mob/target/notify.rb', line 22 def call(mob) raise "not used anymore" args = Arguments.parse(@args) inject_actions(args) # localise to save into closure target = @target # this block is instance_eval'd @act.in_sub_act do send(target, args) end end |
#inject_actions(args) ⇒ Object
18 19 20 |
# File 'lib/angry_mob/target/notify.rb', line 18 def inject_actions(args) args.actions = @actions end |
#inspect ⇒ Object
52 53 54 |
# File 'lib/angry_mob/target/notify.rb', line 52 def inspect "#<AM::T::Notify target=#{@target} actions=#{@actions.inspect}>" end |
#nickname ⇒ Object
5 |
# File 'lib/angry_mob/target/notify.rb', line 5 def nickname; @target end |