Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/html2erb.rb

Instance Method Summary collapse

Instance Method Details

#to_pretty_sObject

ハッシュを [ hoge: ‘fuga’ ] 形式で表現した文字列を返す



156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/html2erb.rb', line 156

def to_pretty_s
  buf = []
  self.each{|k,v|
    buf << "#{k}: '#{v}'" if v != ''
  }
  buf.join(", ")
  # self.to_s.gsub(':', '') # : を取り除く
  # .gsub('=>', ': ') # => を : に
  # .gsub(/\A\{/, '') # 先頭のブラケット
  # .gsub(/\}\z/, '') # 末尾のブラケット
  # .strip.gsub(/,\z/, '') # 末尾のカンマ
end