Class: RSpec::Junklet::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/junklet/formatter.rb

Overview

Formatter.new(input) receives the generated junk, and #format returns the input already formatted. You don’t have to inherit from this class; as long as your class accepts one argument to .new and responds to #format you’re a formatter. Inheriting from Formatter means you already have a basic implementation, however.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Formatter

Returns a new instance of Formatter.



11
12
13
# File 'lib/rspec/junklet/formatter.rb', line 11

def initialize(input)
  @input = input
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



9
10
11
# File 'lib/rspec/junklet/formatter.rb', line 9

def input
  @input
end

Instance Method Details

#formatObject

You probably want to override this



16
17
18
# File 'lib/rspec/junklet/formatter.rb', line 16

def format
  input
end