module SlotMachine
Main module for Slot Machine
Constants
- VERSION
Public Class Methods
helper_module(path: nil)
click to toggle source
create the module to be called as a helper Typically : “`
helper SlotMachine.helper_module(my_path)
““
# File lib/slot_machine/helper.rb, line 14 def self.helper_module(path: nil) # Read slot on the custom path slots = SlotMachine::Service.instance.read_slots(path) # Instantiate the new module @helper_module = Module.new # Add 1 method per partial in the module as well slots.each do |method_name, partial| @helper_module.module_eval do define_method(method_name) do |locals = {}, &block| SlotMachine::Service.instance.render_slot(self, partial, locals, &block) end end end @helper_module end