Class: ProconBypassMan::Procon::MacroBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/procon/macro_builder.rb

Defined Under Namespace

Classes: Subject, SubjectMerger

Constant Summary collapse

RESERVED_WORD_NONE =
:none
RESERVED_WORDS =
{
  RESERVED_WORD_NONE => true,
}

Instance Method Summary collapse

Constructor Details

#initialize(steps) ⇒ MacroBuilder

Returns a new instance of MacroBuilder.



55
56
57
# File 'lib/procon_bypass_man/procon/macro_builder.rb', line 55

def initialize(steps)
  @steps = steps.map(&:to_s)
end

Instance Method Details

#buildArary<Symbol>

Returns:

  • (Arary<Symbol>)


60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/procon_bypass_man/procon/macro_builder.rb', line 60

def build
  steps = @steps.flat_map { |step|
    if is_reserved?(step: step) || v1_format?(step: step)
      step.to_sym
    elsif value = build_if_v2_format?(step: step)
      value
    else
      nil
    end
  }

  steps.compact
end