Class: Alf::Renderer::Rash

Inherits:
Alf::Renderer show all
Defined in:
lib/alf/renderer/rash.rb

Overview

Implements the Renderer contract through inspect

Constant Summary

Constants inherited from Alf::Renderer

DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Alf::Renderer

#input, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Alf::Renderer

by_mime_type, #execute, #initialize, register, renderer

Methods included from Support::Registry

#listen, #listeners, #register, #registered

Constructor Details

This class inherits a constructor from Alf::Renderer

Class Method Details

.mime_typeObject


8
9
10
# File 'lib/alf/renderer/rash.rb', line 8

def self.mime_type
  nil
end

Instance Method Details

#eachObject


12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/alf/renderer/rash.rb', line 12

def each
  return to_enum unless block_given?
  if options[:pretty]
    each_tuple do |tuple|
      yield "{\n" << tuple.map{|k,v| "  #{l(k)} => #{l(v)}"}.join(",\n") << "\n}\n"
    end
  else
    each_tuple do |tuple|
      yield to_rash(tuple) << "\n"
    end
  end
end