Class: CodeFormatter::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/code_formatter/formatters/formatter.rb

Direct Known Subclasses

SwiftFormatFormatter, SwiftLintFormatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, path = Dir.pwd) ⇒ Formatter

Returns a new instance of Formatter.

Raises:

  • (TypeError)


10
11
12
13
14
15
# File 'lib/code_formatter/formatters/formatter.rb', line 10

def initialize(config, path = Dir.pwd)
  raise TypeError unless config.is_a? Configuration
  raise TypeError unless Dir.exist?(path)
  @config = config
  @path = path
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/code_formatter/formatters/formatter.rb', line 7

def config
  @config
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/code_formatter/formatters/formatter.rb', line 8

def path
  @path
end

Instance Method Details

#formatObject

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/code_formatter/formatters/formatter.rb', line 17

def format(*)
  raise NotImplementedError
end