Skip to content

Instantly share code, notes, and snippets.

@ashaninBenjamin
Last active February 18, 2021 08:34
Show Gist options
  • Select an option

  • Save ashaninBenjamin/c36737da26c354c9540e0329008dc19b to your computer and use it in GitHub Desktop.

Select an option

Save ashaninBenjamin/c36737da26c354c9540e0329008dc19b to your computer and use it in GitHub Desktop.

Revisions

  1. ashaninBenjamin revised this gist Feb 18, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions rails_run_file.rb
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,7 @@
    APP_PATH = File.expand_path('../config/application', __FILE__)
    require File.expand_path('../config/environment', __FILE__)
    require_relative 'config/boot'
    ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)

    module Mod
    module_function
  2. ashaninBenjamin created this gist Feb 17, 2021.
    22 changes: 22 additions & 0 deletions rails_run_file.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/usr/bin/env ruby
    APP_PATH = File.expand_path('../config/application', __FILE__)
    require File.expand_path('../config/environment', __FILE__)
    require_relative 'config/boot'

    module Mod
    module_function

    def method1
    'method1'
    end

    def method2
    'method2'
    end
    end

    method = ARGV[0]
    raise ArgumentError, 'mo method passed' unless method

    puts "#{method}..."
    puts Mod.send(method)