class TokyoMetro::Static::Color
鉄道事業者・路線・種別の色の情報を扱うモジュール
Attributes
blue[R]
B 成分の値を返すメソッド @return [Integer]
green[R]
G 成分の値を返すメソッド @return [Integer]
red[R]
R 成分の値を返すメソッド @return [Integer]
web[R]
WebColor を取得するメソッド @return [String]
web_color[R]
WebColor を取得するメソッド @return [String]
Public Class Methods
new( web , red , green , blue )
click to toggle source
Constructor @param web [String] WebColor @param red [Integer] R 成分の値 @param green [Integer] G 成分の値 @param blue [Integer] B 成分の値
# File lib/tokyo_metro/static/color.rb, line 12 def initialize( web , red , green , blue ) @web = web @red = red @green = green @blue = blue end
Public Instance Methods
to_a()
click to toggle source
WebColor, Red, Green, Blue の各成分を配列にして返すメソッド @return [::Array <Integer>]
# File lib/tokyo_metro/static/color.rb, line 65 def to_a [ @web ] + self.to_a_rgb end
to_a_rgb()
click to toggle source
Red, Green, Blue の各成分を配列にして返すメソッド @return [::Array <Integer>]
# File lib/tokyo_metro/static/color.rb, line 59 def to_a_rgb [ @red , @green , @blue ] end
to_csv()
click to toggle source
インスタンスの情報を CSV 出力用の文字列(カンマ区切り)にして返すメソッド @return [String]
# File lib/tokyo_metro/static/color.rb, line 45 def to_csv self.to_a.join(",") end
to_s( indent = 0 )
click to toggle source
インスタンスの情報を文字列に変換して返すメソッド @param indent [Integer (>=0)] インデントの幅 @return [String]
# File lib/tokyo_metro/static/color.rb, line 39 def to_s( indent = 0 ) " " * indent + "#{@web} (#{ self.to_a_rgb.join( " , " ) })" end
to_s_rgb_color_in_parentheses()
click to toggle source
Red, Green, Blue の各成分の情報を括弧で囲んだ文字列にして返すメソッド @return [String]
# File lib/tokyo_metro/static/color.rb, line 51 def to_s_rgb_color_in_parentheses "( " + to_a_rgb.join( " , " ) + " )" end