class NSLayoutConstraint
Constants
- Attributes
- Relationships
Public Instance Methods
to_s()
click to toggle source
# File lib/cocoa/sugarcube-to_s/nslayoutconstraint.rb, line 22 def to_s target = firstItem relative_to = secondItem if firstItem and secondItem if secondItem == firstItem relative_to = :self elsif firstItem.superview and secondItem == firstItem.superview relative_to = :superview elsif secondItem.respond_to?(:stylename) and secondItem.stylename relative_to = secondItem.stylename end if secondItem.superview and firstItem == secondItem.superview target = :superview elsif firstItem.respond_to?(:stylename) and firstItem.stylename target = firstItem.stylename end elsif firstItem if firstItem.respond_to?(:stylename) and firstItem.stylename target = firstItem.stylename end elsif secondItem if secondItem.respond_to?(:stylename) and secondItem.stylename target = secondItem.stylename end end op = case _to_s_relationship_reverse relation when :equal '==' when :gte '>=' when :lte '<=' end formula = 'first.' formula << _to_s_attribute_reverse(firstAttribute).to_s formula << ' ' << op << ' ' if multiplier != 1 formula << multiplier.to_s << ' × ' end if secondItem if firstItem == secondItem formula << 'first.' else formula << 'second.' end formula << _to_s_attribute_reverse(secondAttribute).to_s end if constant != 0 if secondItem formula << ' + ' end formula << constant.to_s end return "#<#{self.class}:##{object_id.to_s(16)}" + " firstItem=#{target.inspect}" + " secondItem=#{relative_to.inspect}" + " priority=#{priority.inspect}" + " formula=#{formula.inspect}" + ">" end
Private Instance Methods
_to_s_attribute_reverse(attribute)
click to toggle source
# File lib/cocoa/sugarcube-to_s/nslayoutconstraint.rb, line 88 def _to_s_attribute_reverse(attribute) Attributes.key(attribute) || :none end
_to_s_relationship_reverse(relationship)
click to toggle source
# File lib/cocoa/sugarcube-to_s/nslayoutconstraint.rb, line 92 def _to_s_relationship_reverse(relationship) Relationships.key(relationship) end