1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Rename Base formatter to Formatter

This commit is contained in:
Mauro George 2015-03-19 18:09:53 -03:00
parent d2a07190c2
commit de51f83260
35 changed files with 35 additions and 35 deletions

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
require 'awesome_print/formatters/base'
require 'awesome_print/formatters/formatter'
require 'awesome_print/formatters/self'
require 'awesome_print/formatters/array'
require 'awesome_print/formatters/hash'

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class ActiveRecordClass < Base
class ActiveRecordClass < Formatter
def call
return object.inspect if not_a_active_record_class?

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class ActiveRecordInstance < Base
class ActiveRecordInstance < Formatter
# Format ActiveRecord instance object.
#

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class ActiveSupportTime < Base
class ActiveSupportTime < Formatter
def call
formatter.colorize(object.inspect, :time)

View file

@ -3,7 +3,7 @@ require 'awesome_print/formatters/method_tuple'
module AwesomePrint
module Formatters
class Array < Base
class Array < Formatter
include Enumerable
include MethodTuple

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Bigdecimal < Base
class Bigdecimal < Formatter
def call
formatter.colorize(object.to_s('F'), :bigdecimal)

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Class < Base
class Class < Formatter
def call
if superclass = object.superclass # <-- Assign and test if nil.

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Dir < Base
class Dir < Formatter
def call
ls = `ls -alF #{object.path.shellescape}`

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class File < Base
class File < Formatter
def call
ls = ::File.directory?(object) ? `ls -adlF #{object.path.shellescape}` : `ls -alF #{object.path.shellescape}`

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Base
class Formatter
def initialize(formatter, object)
@formatter = formatter

View file

@ -2,7 +2,7 @@ require 'awesome_print/formatters/enumerable'
module AwesomePrint
module Formatters
class Hash < Base
class Hash < Formatter
include Enumerable
def call

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class HashWithIndifferentAccess < Base
class HashWithIndifferentAccess < Formatter
def call
AwesomePrint::Formatters::Hash.new(formatter, object).call

View file

@ -2,7 +2,7 @@ require 'awesome_print/formatters/method_tuple'
module AwesomePrint
module Formatters
class Method < Base
class Method < Formatter
include MethodTuple
def call

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class MongoMapperAssociation < Base
class MongoMapperAssociation < Formatter
def call
return object.inspect if !defined?(::ActiveSupport::OrderedHash)

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class MongoMapperBsonId < Base
class MongoMapperBsonId < Formatter
def call
object.inspect

View file

@ -2,7 +2,7 @@ require 'awesome_print/formatters/mongo_mapper'
module AwesomePrint
module Formatters
class MongoMapperClass < Base
class MongoMapperClass < Formatter
include MongoMapper
def call

View file

@ -2,7 +2,7 @@ require 'awesome_print/formatters/mongo_mapper'
module AwesomePrint
module Formatters
class MongoMapperInstance < Base
class MongoMapperInstance < Formatter
include MongoMapper
# Format MongoMapper instance object.

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class MongoidBsonId < Base
class MongoidBsonId < Formatter
def call
object.inspect

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class MongoidClass < Base
class MongoidClass < Formatter
def call
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:fields)

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class MongoidDocument < Base
class MongoidDocument < Formatter
def call
return object.inspect if !defined?(::ActiveSupport::OrderedHash)

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class NobrainerClass < Base
class NobrainerClass < Formatter
def call
"class #{object} < #{object.superclass} " << AwesomePrint::Formatters::Hash.new(formatter, columns).call

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class NobrainerDocument < Base
class NobrainerDocument < Formatter
def call
"#{object} #{AwesomePrint::Formatters::Hash.new(formatter, columns).call}"

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class NokogiriXmlNode < Base
class NokogiriXmlNode < Formatter
def call
if empty?

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Object < Base
class Object < Formatter
def call
build_vars

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class OpenStructInstance < Base
class OpenStructInstance < Formatter
def call
"#{object.class} #{AwesomePrint::Formatters::Hash.new(formatter, object.marshal_dump).call}"

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Rational < Base
class Rational < Formatter
def call
formatter.colorize(object.to_s, :rational)

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class RippleDocumentClass < Base
class RippleDocumentClass < Formatter
def call
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:properties)

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class RippleDocumentInstance < Base
class RippleDocumentInstance < Formatter
# Format Ripple instance object.
#

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Self < Base
class Self < Formatter
def call
if options[:raw] && object.instance_variables.any?

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class SequelDataset < Base
class SequelDataset < Formatter
def call
[AwesomePrint::Formatters::Array.new(formatter, object.to_a).call,

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class SequelDocument < Base
class SequelDocument < Formatter
def call
data = object.values.sort_by { |key| key.to_s }.inject({}) do |hash, c|

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class SequelModelClass < Base
class SequelModelClass < Formatter
def call
data = object.db_schema.inject({}) {|h, (name,data)| h.merge(name => data[:db_type])}

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Set < Base
class Set < Formatter
def call
AwesomePrint::Formatters::Array.new(formatter, object.to_a).call

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Struct < Base
class Struct < Formatter
#
# The code is slightly uglier because of Ruby 1.8.6 quirks:
# awesome_hash(Hash[s.members.zip(s.values)]) <-- ArgumentError: odd number of arguments for Hash)

View file

@ -1,6 +1,6 @@
module AwesomePrint
module Formatters
class Unboundmethod < Base
class Unboundmethod < Formatter
def call
AwesomePrint::Formatters::Method.new(formatter, object).call