Sha256: bf6f81a5a7114c153f7fc7695ee0eb4a5c2383bb23c0708debefd33ec45a88c3

Contents?: true

Size: 794 Bytes

Versions: 48

Compression:

Stored size: 794 Bytes

Contents

class UIColor

  def to_s
    return super unless self.respond_to?(:alpha)

    alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
    system_color = system_name
    return "UIColor.#{system_color}#{alpha_s}" if system_color

    alpha_s = ((alpha || 1) < 1 ? ", alpha: #{alpha}" : '')
    inside = (css_name && ":#{css_name}") || (hex && "'#{hex}'")
    if inside
      return "UIColor.color(#{inside}#{alpha_s})"
    else
      super
    end
  end

  def inspect
    return super unless self.respond_to?(:alpha)

    alpha_s = ((alpha || 1) < 1 ? "(#{alpha})" : '')
    if system_name
      return "UIColor.#{system_name}#{alpha_s}"
    elsif css_name
      return ":#{css_name}.uicolor#{alpha_s}"
    elsif hex
      return "'#{hex}'.uicolor#{alpha_s}"
    else
      super
    end
  end

end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
sugarcube-2.4.0 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.3.0 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.2.0 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.1.5 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.1.4 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.1.3 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.1.2 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.1.1 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.1.0 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.0.2 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.0.1 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-2.0.0 lib/ios/sugarcube-to_s/uicolor.rb
sugarcube-1.7.0 lib/sugarcube-to_s/uicolor.rb
sugarcube-1.6.3 lib/sugarcube-to_s/uicolor.rb
sugarcube-1.6.2 lib/sugarcube-to_s/uicolor.rb
sugarcube-1.6.1 lib/sugarcube-to_s/uicolor.rb
sugarcube-1.6.0 lib/sugarcube-to_s/uicolor.rb
sugarcube-1.5.9 lib/sugarcube-to_s/uicolor.rb
sugarcube-1.5.8 lib/sugarcube-to_s/uicolor.rb
sugarcube-1.5.7 lib/sugarcube-to_s/uicolor.rb