Sha256: 4c351448a58f443b45667d5df6456ccc1cac9d513752010371a130e9371b1c59

Contents?: true

Size: 846 Bytes

Versions: 2

Compression:

Stored size: 846 Bytes

Contents

module Runbook::Extensions
  module Statements
    module DSL
      ruby2_keywords def method_missing(name, *args, &block)
        if (klass = Statements::DSL._statement_class(name))
          klass.new(*args, &block).tap do |statement|
            parent.add(statement)

            if statement.respond_to?(:into)
              Runbook.runtime_methods << statement.into
            end
          end
        else
          super
        end
      end

      def respond_to?(name, include_private = false)
        !!(Statements::DSL._statement_class(name) || super)
      end

      def self._statement_class(name)
        "Runbook::Statements::#{name.to_s.camelize}".constantize
      rescue NameError
      end
    end
  end

  Runbook::Entities::Setup::DSL.prepend(Statements::DSL)
  Runbook::Entities::Step::DSL.prepend(Statements::DSL)
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
careacademy-runbook-1.2.0 lib/runbook/extensions/statements.rb
runbook-1.1.0 lib/runbook/extensions/statements.rb