Sha256: f1c8a7b57e6494b77b93ecc70789f238b88bd37a3a0e397c151ed89564f5aeff

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

module SteelWheel
  class GenericGenerator < Rails::Generators::NamedBase
    def self.setup_templates_root(templates_relative_path)
      source_root File.expand_path(templates_relative_path, __dir__)
    end

    def self.on_revoke(&block)
      block_given? ? @on_revoke = block : @on_revoke
    end

    def self.on_invoke(&block)
      block_given? ? @on_invoke = block : @on_invoke
    end

    def copy_files
      if behavior == :revoke
        instance_eval(&self.class.on_revoke)
      elsif behavior == :invoke
        instance_eval(&self.class.on_invoke)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
steel_wheel-0.5.1 lib/generators/steel_wheel/generic_generator.rb
steel_wheel-0.5.0 lib/generators/steel_wheel/generic_generator.rb