Sha256: 852505fff1e5ac89b2116630ee77b42d4393c3f03b4247fd001d00108aef071e

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

class UIColor

  def to_s
    system_color = system_name
    return system_color if system_color

    inside = self.css_name || self.hex
    if inside
      if self.alpha < 1
        return "UIColor.color(#{inside}, #{alpha})"
      else
        return "UIColor.color(#{inside})"
      end
    else
      super
    end
  end

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sugarcube-0.19.2 lib/sugarcube/to_s/uicolor.rb