Sha256: f9829d772d405fcdb108dee06a45552fb802f88a6e668c806e72ba02d5e48452

Contents?: true

Size: 657 Bytes

Versions: 4

Compression:

Stored size: 657 Bytes

Contents

module Runbook::Extensions
  module Statements
    module DSL
      def method_missing(name, *args, &block)
        if (klass = Statements::DSL._statement_class(name))
          klass.new(*args, &block).tap do |statement|
            parent.add(statement)
          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::Step::DSL.prepend(Statements::DSL)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
runbook-0.15.0 lib/runbook/extensions/statements.rb
runbook-0.14.0 lib/runbook/extensions/statements.rb
runbook-0.13.0 lib/runbook/extensions/statements.rb
runbook-0.12.1 lib/runbook/extensions/statements.rb