Sha256: a911a4f5df98673d15cf89e4fb46f355aecd73c96c53544329672f7e9769595e

Contents?: true

Size: 661 Bytes

Versions: 5

Compression:

Stored size: 661 Bytes

Contents

module Dox
  module DSL
    class Action
      include AttrProxy

      attr_writer :name
      attr_writer :verb
      attr_writer :path
      attr_writer :desc
      attr_writer :params

      def initialize(name, &block)
        self.name = name
        instance_eval(&block) if block_given?

        raise(Dox::Errors::InvalidActionError, 'Action name is required!') if @name.blank?
      end

      def config
        {
          action_name: @name.presence,
          action_verb: @verb.presence,
          action_path: @path.presence,
          action_desc: @desc.presence,
          action_params: @params.presence
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dox-1.1.0 lib/dox/dsl/action.rb
dox-1.0.2 lib/dox/dsl/action.rb
dox-1.0.1 lib/dox/dsl/action.rb
dox-1.0.0 lib/dox/dsl/action.rb
dox-1.0.0.alpha lib/dox/dsl/action.rb