Module: MooTool::Formatters::DigestFormatter

Defined in:
lib/mootool/formatters/digest_formatter.rb

Instance Method Summary collapse

Instance Method Details

#awesome_digest(object) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mootool/formatters/digest_formatter.rb', line 6

def awesome_digest(object)
  files = object.files.map do |f|
    "#{' ' * @inspector.current_indentation}#{colorize('match', :args)}: #{colorize(f.fullname, :path)}"
  end
  formatted = if object.integer?
                colorize(object.inspect, :integer)
              elsif object.hint
                properties = object.properties.any? ? " (#{object.properties.join(',')})" : ''
                "#{colorize(object.hint, :class)}#{properties} #{colorize(object.inspect, :digest)}"
              else
                colorize(object.inspect, :digest).to_s
              end

  if files.any?
    "#{formatted}\n#{files.join("\n")}"
  else
    formatted
  end
end