lib/motion-kit-cocoa/constraints/constraint.rb in motion-kit-0.10.11 vs lib/motion-kit-cocoa/constraints/constraint.rb in motion-kit-0.11.0
- old
+ new
@@ -72,11 +72,10 @@
end
def ==(compare)
if @compare_flag
equals(compare)
- @compare_flag = false
self
else
super
end
@@ -87,11 +86,10 @@
if @relationship && Constraint.relationship_lookup(@relationship) != NSLayoutRelationEqual
raise InvalidRelationshipError.new("You cannot use `.is >=` on a constraint that is already defined as #{@relationship}")
end
gte(compare)
- @compare_flag = false
self
else
super
end
@@ -102,11 +100,10 @@
if @relationship && Constraint.relationship_lookup(@relationship) != NSLayoutRelationEqual
raise InvalidRelationshipError.new("You cannot use `.is <=` on a constraint that is already defined as #{@relationship}")
end
lte(compare)
- @compare_flag = false
self
else
super
end
@@ -277,37 +274,39 @@
class << self
def axis_lookup(axis)
case axis
when :horizontal
- axis = UILayoutConstraintAxisHorizontal
+ UILayoutConstraintAxisHorizontal
when :vertical
- axis = UILayoutConstraintAxisVertical
+ UILayoutConstraintAxisVertical
+ else
+ axis
end
-
- return axis
end
def orientation_lookup(orientation)
case orientation
when :horizontal
- orientation = NSLayoutConstraintOrientationHorizontal
+ NSLayoutConstraintOrientationHorizontal
when :vertical
- orientation = NSLayoutConstraintOrientationVertical
+ NSLayoutConstraintOrientationVertical
+ else
+ orientation
end
-
- return orientation
end
def view_lookup(layout, view, target)
if ! target || target.is_a?(MotionKit.base_view_class)
target
elsif target.is_a?(ConstraintPlaceholder)
target.resolve(layout)
+ elsif target == :self
+ view
elsif target == :superview
view.superview
else
- layout.get(target)
+ layout.get_view(target)
end
end
def attribute_lookup(attribute)
if attribute.is_a? Fixnum