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) ⇒ Formatter

Returns a new instance of Formatter.

Raises:

  • (TypeError)


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

def initialize(config, path)
  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.



5
6
7
# File 'lib/code_formatter/formatters/formatter.rb', line 5

def config
  @config
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#formatObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/code_formatter/formatters/formatter.rb', line 15

def format
  raise NotImplementedError
end