Sha256: 7aed103504b1a87aa6a9af1ea376e2f8fc1a2da7229cafe9570ebe2147d60daa
Contents?: true
Size: 825 Bytes
Versions: 2
Compression:
Stored size: 825 Bytes
Contents
class ActorDefinition attr_accessor :behaviors, :attributes, :view_blk, :behavior_blk, :source def initialize @behaviors = [] @attributes = [] end def has_behaviors(*behaviors, &blk) if block_given? collector = MethodMissingCollector.new collector.instance_eval &blk collector.calls.each do |name, args| if args.empty? @behaviors << name else @behaviors << {name => args.first} end end end behaviors.each do |beh| @behaviors << beh end end alias has_behavior has_behaviors def has_attributes(*attributes) attributes.each do |att| @attributes << att end end alias has_attribute has_attributes def view(&blk) @view_blk = blk end def behavior(&blk) @behavior_blk = blk end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gamebox-0.4.0 | lib/gamebox/core/actor_definition.rb |
gamebox-0.4.0.rc11 | lib/gamebox/core/actor_definition.rb |