Sha256: 3fe655802f70bc5432b7db8b1d30b115b5f805eefafbf9380be7121bfb0d25b1

Contents?: true

Size: 673 Bytes

Versions: 5

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators/base'

module GraphQL
  module Generators
    class ChannelGenerator < Rails::Generators::Base # :nodoc:
      include Rails::GraphQL::BaseGenerator

      desc 'Add a new action cable channel that operates with GraphQL'

      argument :name, type: :string, optional: true,
        default: "GraphQLChannel",
        desc: 'The name for the channel'

      def create_channel_file
        template 'channel.erb', "app/channels/#{channel_name.underscore}.rb"
      end

      private

        def channel_name
          @channel_name ||= options.fetch(:name, 'GraphQLChannel').classify
        end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-graphql-1.0.2 lib/generators/graphql/channel_generator.rb
rails-graphql-1.0.1 lib/generators/graphql/channel_generator.rb
rails-graphql-1.0.0 lib/generators/graphql/channel_generator.rb
rails-graphql-1.0.0.rc2 lib/generators/graphql/channel_generator.rb
rails-graphql-1.0.0.rc1 lib/generators/graphql/channel_generator.rb