Sha256: f8cfcfed3b2f91097328d399cc59de7d3f202c098e756f8d5cc1d27d0c73fe5c

Contents?: true

Size: 452 Bytes

Versions: 10

Compression:

Stored size: 452 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators/base'

class BeaconGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('templates', __dir__)

  def create_beacon_file
    template 'beacon.rb.tt', File.join('app', 'beacons', class_path, "#{file_name}_beacon.rb")
  end

  def insert_inclusion_into_model_file
    inject_into_class "app/models/#{file_name}.rb", class_name do
      "  include Beaconable\n"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
beaconable-0.3.4 lib/generators/beacon/beacon_generator.rb
beaconable-0.3.3 lib/generators/beacon/beacon_generator.rb
beaconable-0.3.2 lib/generators/beacon/beacon_generator.rb
beaconable-0.3.1 lib/generators/beacon/beacon_generator.rb
beaconable-0.2.3 lib/generators/beacon/beacon_generator.rb
beaconable-0.2.2 lib/generators/beacon/beacon_generator.rb
beaconable-0.2.1 lib/generators/beacon/beacon_generator.rb
beaconable-0.2.0 lib/generators/beacon/beacon_generator.rb
beaconable-0.1.2 lib/generators/beacon/beacon_generator.rb
beaconable-0.1.1 lib/generators/beacon/beacon_generator.rb