Class: Campa::Printer
- Inherits:
-
Object
- Object
- Campa::Printer
- Defined in:
- lib/campa/printer.rb
Constant Summary collapse
- FORMATS =
{ String => :string, Symbol => :symbol, List => :list, TrueClass => :boolean, FalseClass => :boolean, Lambda => :lambda, Context => :context, NilClass => :null, }.freeze
Instance Method Summary collapse
Instance Method Details
#call(expr) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/campa/printer.rb', line 14 def call(expr) format = FORMATS.fetch(expr.class) do expr.is_a?(Context) ? :context : :default end send(format, expr) end |