Class: I18nFlow::Splitter::Strategy
- Inherits:
-
Object
- Object
- I18nFlow::Splitter::Strategy
- Defined in:
- lib/i18n_flow/splitter/strategy.rb
Constant Summary collapse
- DEFAULT_MAX_LEVEL =
3
- DEFAULT_LINE_THRESHOLD =
50
Instance Method Summary collapse
- #chunks ⇒ Object
-
#initialize(ast, max_level: DEFAULT_MAX_LEVEL, line_threshold: DEFAULT_LINE_THRESHOLD) ⇒ Strategy
constructor
A new instance of Strategy.
- #split! ⇒ Object
Constructor Details
#initialize(ast, max_level: DEFAULT_MAX_LEVEL, line_threshold: DEFAULT_LINE_THRESHOLD) ⇒ Strategy
Returns a new instance of Strategy.
6 7 8 9 10 11 12 13 14 |
# File 'lib/i18n_flow/splitter/strategy.rb', line 6 def initialize( ast, max_level: DEFAULT_MAX_LEVEL, line_threshold: DEFAULT_LINE_THRESHOLD ) @ast = ast @max_level = max_level @line_threshold = line_threshold end |
Instance Method Details
#chunks ⇒ Object
21 22 23 |
# File 'lib/i18n_flow/splitter/strategy.rb', line 21 def chunks @chunks ||= Hash.new { |h, k| h[k] = [] } end |
#split! ⇒ Object
16 17 18 19 |
# File 'lib/i18n_flow/splitter/strategy.rb', line 16 def split! @chunks = nil traverse(@ast, level: 0) end |