module AwesomePrint::Bruhl
Public Class Methods
included(base)
click to toggle source
# File lib/bruhl/awesome_print.rb, line 5 def self.included(base) base.send :alias_method, :cast_without_bruhl, :cast base.send :alias_method, :cast, :cast_with_bruhl end
Public Instance Methods
awesome_bruhl_object(object)
click to toggle source
# File lib/bruhl/awesome_print.rb, line 20 def awesome_bruhl_object(object) str = awesome_array(object.contents) str = "#{colorize(object.tag, :class)}: #{str}" if object.tag str end
awesome_bruhl_relation(relation)
click to toggle source
# File lib/bruhl/awesome_print.rb, line 26 def awesome_bruhl_relation(relation) right = case relation.right when ::Bruhl::Object awesome_bruhl_object(relation.right) when ::Bruhl::Relation awesome_bruhl_relation(relation.right) when ::Bruhl::RawString, ::Bruhl::QuotedString colorize(relation.right.to_s, :string) when ::Float, ::Integer relation.right.ai end [ colorize(relation.left.to_s, :method), colorize(relation.operator, :symbol), right ].join(' ') end
cast_with_bruhl(object, type)
click to toggle source
# File lib/bruhl/awesome_print.rb, line 10 def cast_with_bruhl(object, type) cast = cast_without_bruhl(object, type) if defined?(::Bruhl::Object) && object.is_a?(::Bruhl::Object) cast = :bruhl_object elsif defined?(::Bruhl::Relation) && object.is_a?(::Bruhl::Relation) cast = :bruhl_relation end cast end