Class: Manacle::Constraint::Actuator::Base
- Inherits:
-
Object
- Object
- Manacle::Constraint::Actuator::Base
- Includes:
- Manacle::Constraint::Actuator
- Defined in:
- lib/manacle/constraint/actuator/base.rb
Instance Method Summary collapse
- #constrain ⇒ Object
-
#initialize(val, constraint) ⇒ Base
constructor
A new instance of Base.
- #levels ⇒ Object
- #proxy ⇒ Object
- #reconstrain(obj) ⇒ Object
- #unconstrain ⇒ Object
Methods included from Manacle::Constraint::Actuator
Constructor Details
#initialize(val, constraint) ⇒ Base
Returns a new instance of Base.
16 17 18 19 20 21 22 |
# File 'lib/manacle/constraint/actuator/base.rb', line 16 def initialize(val, constraint) if val.kind_of?(self.class) raise end @val = val @constraint = constraint end |
Instance Method Details
#constrain ⇒ Object
40 41 42 |
# File 'lib/manacle/constraint/actuator/base.rb', line 40 def constrain @constrained ||= @constraint.base_constrain(@val) end |
#levels ⇒ Object
28 29 30 |
# File 'lib/manacle/constraint/actuator/base.rb', line 28 def levels [self.class, @val.class] end |
#proxy ⇒ Object
32 33 34 |
# File 'lib/manacle/constraint/actuator/base.rb', line 32 def proxy Manacle::Proxy::Templates.for(@val) end |
#reconstrain(obj) ⇒ Object
36 37 38 |
# File 'lib/manacle/constraint/actuator/base.rb', line 36 def reconstrain(obj) self.class.new(obj, @constraint) end |
#unconstrain ⇒ Object
24 25 26 |
# File 'lib/manacle/constraint/actuator/base.rb', line 24 def unconstrain @val end |