Permalink
Browse files

Fixed default usage attribute on specs

  • Loading branch information...
1 parent 00a38d7 commit e00cc12d554def782249477e8ca68b88dd727424 @krakatoa krakatoa committed Sep 27, 2012
Showing with 23 additions and 7 deletions.
  1. +19 −3 lib/protocol/action_specification.rb
  2. +3 −3 lib/protocol/object_specification.rb
  3. +1 −1 spec/mock/protocol.ini
@@ -28,15 +28,31 @@ def read_by=(read_by)
end
def uses_box
- @uses_box || object_specification.has_default?(:box)
+ if uses_defined?
+ @uses_box || false
+ else
+ object_specification.has_default?(:box)
+ end
end
def uses_mailbox
- @uses_mailbox || object_specification.has_default?(:mailbox)
+ if uses_defined?
+ @uses_mailbox || false
+ else
+ object_specification.has_default?(:mailbox)
+ end
end
def uses_board
- @uses_board || object_specification.has_default?(:board)
+ if uses_defined?
+ @uses_board || false
+ else
+ object_specification.has_default?(:board)
+ end
+ end
+
+ def uses_defined?
+ @uses_box || @uses_mailbox || @uses_board
end
def serialize
@@ -33,15 +33,15 @@ def has_default?(uses)
end
def uses_box
- @action_specifications.select(&:uses_box).size > 0
+ has_default?(:box) || !@action_specifications.select(&:uses_box).empty?
end
def uses_mailbox
- @action_specifications.select(&:uses_mailbox).size > 0
+ has_default?(:mailbox) || !@action_specifications.select(&:uses_mailbox).empty?
end
def uses_board
- @action_specifications.select(&:uses_board).size > 0
+ has_default?(:board) || !@action_specifications.select(&:uses_board).empty?
end
def serialize
View
@@ -13,7 +13,7 @@
read_by = core
[agent]
- uses_mailbox = true
+ default_uses = board
role = emitter
[agent#metric]

0 comments on commit e00cc12

Please sign in to comment.