Class: Ea::Spa::Output::Strategy

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/spa/output/strategy.rb

Overview

Abstract output strategy. Concrete subclasses project the same SPA artifacts (skeleton, search index, shards) to disk in different layouts.

Adding a new layout = new subclass + registration in Generator::OUTPUT_STRATEGIES. No edit to Projector or existing strategies.

Direct Known Subclasses

ShardedMultiFileStrategy, SingleFileStrategy

Constant Summary collapse

SIZE_THRESHOLD_BYTES =

2 MB

2 * 1024 * 1024

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_path) ⇒ Strategy

Returns a new instance of Strategy.



18
19
20
# File 'lib/ea/spa/output/strategy.rb', line 18

def initialize(output_path)
  @output_path = output_path
end

Instance Attribute Details

#output_pathObject (readonly)

Returns the value of attribute output_path.



16
17
18
# File 'lib/ea/spa/output/strategy.rb', line 16

def output_path
  @output_path
end

Instance Method Details

#render(_projector) ⇒ Object

Raises:

  • (NotImplementedError)


22
23
24
25
# File 'lib/ea/spa/output/strategy.rb', line 22

def render(_projector)
  raise NotImplementedError,
        "#{self.class} must implement #render"
end