capability.rb 524 B

1234567891011121314151617181920212223242526
  1. module Zori
  2. # Capability stores the capabilities of a widget or Hanao.
  3. class Capability
  4. # Initializes the capabilities.
  5. # Capabilities are normally fixed for every widget
  6. # so we dontn't need setters.
  7. def initialize(caps={})
  8. @caps = { :drag => false, :focus => false }
  9. @caps = @caps.merge(caps)
  10. end
  11. def can?(capa)
  12. return @caps[capa.to_sym]
  13. end
  14. def drag?
  15. return do?(:drag)
  16. end
  17. def focus?
  18. return do?(:focus)
  19. end
  20. end
  21. end