Module: ProconBypassMan::Web::SettingParser::TopLevelLayer::Syntax

Included in:
ProconBypassMan::Web::SettingParser::TopLevelLayer
Defined in:
lib/procon_bypass_man/web/setting_parser/top_level_layer.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *_args) ⇒ Object



98
99
100
101
# File 'lib/procon_bypass_man/web/setting_parser/top_level_layer.rb', line 98

def method_missing(name, *_args)
  ProconBypassMan::Web.logger.info("unknown toplevel DSL #{name}")
  self
end

Instance Method Details

#initializeObject



65
66
67
68
# File 'lib/procon_bypass_man/web/setting_parser/top_level_layer.rb', line 65

def initialize
  @installed_plugin = { macros: [], modes: [] }
  @layers = {}
end

#install_macro_plugin(name) ⇒ Object



70
71
72
# File 'lib/procon_bypass_man/web/setting_parser/top_level_layer.rb', line 70

def install_macro_plugin(name)
  @installed_plugin[:macros] << name.to_s
end

#install_mode_plugin(name) ⇒ Object



74
75
76
# File 'lib/procon_bypass_man/web/setting_parser/top_level_layer.rb', line 74

def install_mode_plugin(name)
  @installed_plugin[:modes] << name.to_s
end

#layer(dir, mode: nil, &block) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/procon_bypass_man/web/setting_parser/top_level_layer.rb', line 86

def layer(dir, mode: nil, &block)
  if(mode == :manual || mode == 'manual')
    mode = nil
  end

  if block_given?
    @layers[dir] = Layer.new(mode: mode).instance_eval(&block) || Layer.new(mode: mode)
  else
    @layers[dir] = Layer.new(mode: mode)
  end
end

#prefix_keys_for_changing_layer(value = nil) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/procon_bypass_man/web/setting_parser/top_level_layer.rb', line 78

def prefix_keys_for_changing_layer(value=nil)
  if value
    @prefix_keys_for_changing_layer = value
  else
    @prefix_keys_for_changing_layer
  end
end