display_compact_table(hashes, keys = nil, &block)
click to toggle source
def self.display_compact_table(hashes, keys = nil, &block)
::Formatador.display_compact_table(hashes, keys, &block)
end
display_line(data)
click to toggle source
def self.display_line(data)
::Formatador.display_line(data)
end
display_lines(data)
click to toggle source
def self.display_lines(data)
::Formatador.display_lines(data)
end
display_table(hashes, keys = nil, &block)
click to toggle source
def self.display_table(hashes, keys = nil, &block)
::Formatador.display_table(hashes, keys, &block)
end
redisplay_progressbar(current, total, options = {})
click to toggle source
def self.redisplay_progressbar(current, total, options = {})
::Formatador.redisplay_progressbar(current, total, options = {})
end
attribute_string(object)
click to toggle source
def self.attribute_string(object)
return "" unless object.class.respond_to?(:attributes)
if object.class.attributes.empty?
""
else
"#{indentation}#{object_attributes(object)}\n"
end
end
indent(&block)
click to toggle source
def self.indent(&block)
formatador.indent(&block)
end
indentation()
click to toggle source
def self.indentation
formatador.indentation
end
init_string(object)
click to toggle source
def self.init_string(object)
"#{indentation}<#{object.class.name}\n"
end
inspect_object(object)
click to toggle source
def self.inspect_object(object)
return "" unless object.respond_to?(:map)
object.map { |o| indentation + o.inspect }.join(", \n#{indentation}")
end
nested_objects_string(object)
click to toggle source
def self.nested_objects_string(object)
nested = ""
return nested if object.respond_to?(:empty) and object.empty?
return nested unless object.respond_to?(:map)
nested = "#{indentation}[\n"
indent { nested << indentation + inspect_object(object) }
nested << "#{indentation}\n#{indentation}]\n"
end
object_attributes(object)
click to toggle source
def self.object_attributes(object)
attrs = object.class.attributes.map do |attr|
"#{attr}=#{object.send(attr).inspect}"
end
attrs.join(",\n#{indentation}")
end
object_string(object, opts)
click to toggle source
def self.object_string(object, opts)
string = "#{attribute_string(object)}"
string << "#{nested_objects_string(object)}" if opts[:include_nested]
string
end