Sha256: b9f5ef81e5de5525ba9a86b9ac2af1fc3f5d5dee1557ac00154f2b71b6a8eaf9

Contents?: true

Size: 900 Bytes

Versions: 5

Compression:

Stored size: 900 Bytes

Contents

class UIView

  def sugarcube_to_s(options={})
    if self.respond_to? :stylename and self.stylename
      suffix = ' stylename: ' + self.stylename.inspect
    else
      suffix = ''
    end
    if options[:inner].is_a? Hash
      inner = ''
      options[:inner].each do |key, value|
        inner += ', ' if inner.length > 0
        inner += "#{key}: #{value.inspect}"
      end
    else
      inner = options[:inner]
    end

    "#{self.class.to_s}(##{self.object_id.to_s(16)}, [[#{frame.origin.x}, #{frame.origin.y}], [#{frame.size.width}, #{frame.size.height}]]" +
                        (inner ? ', ' + inner : '') +
                        ')' +
                        (options.fetch(:superview, true) && self.superview ? ", child of #{self.superview.class.to_s}(##{self.superview.object_id.to_s(16)})" : '') +
                        suffix
  end

  def to_s
    sugarcube_to_s
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sugarcube-2.1.1 lib/ios/sugarcube-to_s/uiview.rb
sugarcube-2.1.0 lib/ios/sugarcube-to_s/uiview.rb
sugarcube-2.0.2 lib/ios/sugarcube-to_s/uiview.rb
sugarcube-2.0.1 lib/ios/sugarcube-to_s/uiview.rb
sugarcube-2.0.0 lib/ios/sugarcube-to_s/uiview.rb