Module: Manacle::Constraint::InstanceMethods
- Defined in:
- lib/manacle/constraint.rb
Instance Attribute Summary collapse
-
#actuator ⇒ Object
readonly
Returns the value of attribute actuator.
Instance Method Summary collapse
- #constrain ⇒ Object
- #constrainables ⇒ Object
- #initialize(obj) ⇒ Object
- #klass ⇒ Object
- #levels ⇒ Object
- #proxy ⇒ Object
- #reconstrain(obj) ⇒ Object
- #unconstrain ⇒ Object
Instance Attribute Details
#actuator ⇒ Object (readonly)
Returns the value of attribute actuator.
28 29 30 |
# File 'lib/manacle/constraint.rb', line 28 def actuator @actuator end |
Instance Method Details
#constrain ⇒ Object
43 44 45 |
# File 'lib/manacle/constraint.rb', line 43 def constrain @actuator.constrain end |
#constrainables ⇒ Object
30 31 32 |
# File 'lib/manacle/constraint.rb', line 30 def constrainables self.class.constrainables end |
#initialize(obj) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/manacle/constraint.rb', line 12 def initialize(obj) if obj.nil? raise end if obj.class < Manacle::Proxy raise end @actuator = if obj.class < Actuator obj else Actuator.build(obj, self) end end |
#klass ⇒ Object
55 56 57 |
# File 'lib/manacle/constraint.rb', line 55 def klass @actuator.constrain.class end |
#levels ⇒ Object
59 60 61 |
# File 'lib/manacle/constraint.rb', line 59 def levels ["CONSTRAINT #{constraint}"] + @actuator.levels end |
#proxy ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/manacle/constraint.rb', line 47 def proxy proxy_class = @actuator.proxy unless proxy_class.kind_of?(Class) raise "#{@actuator.inspect} is proxying non-classes: #{self.levels}" end proxy_class.new(self) end |
#reconstrain(obj) ⇒ Object
34 35 36 37 |
# File 'lib/manacle/constraint.rb', line 34 def reconstrain(obj) r = @actuator.reconstrain(obj) self.class.new(r) end |
#unconstrain ⇒ Object
39 40 41 |
# File 'lib/manacle/constraint.rb', line 39 def unconstrain @actuator.unconstrain end |