class MotionBindable::Strategy
Attributes
attr_name[R]
bound[RW]
object[RW]
Public Class Methods
find_by_reference(object)
click to toggle source
# File lib/motion_bindable/strategy.rb, line 9 def self.find_by_reference(object) @strategies_map.reverse.find do |h| h[:candidates].one? { |e| object.is_a? e } end.fetch(:class) end
new(object, attr_name)
click to toggle source
# File lib/motion_bindable/strategy.rb, line 19 def initialize(object, attr_name) @attr_name = attr_name.to_sym self.object = object end
register_strategy(strategy, *objects)
click to toggle source
# File lib/motion_bindable/strategy.rb, line 5 def self.register_strategy(strategy, *objects) @strategies_map << { class: strategy, candidates: objects } end