Sha256: 406544e7748f5d9f03e1475d51e9484f2cb553f66df65ca4196e80b78edcc407

Contents?: true

Size: 932 Bytes

Versions: 5

Compression:

Stored size: 932 Bytes

Contents

module Runbook
  def self.entities
    _child_classes(Runbook::Entities)
  end

  def self.statements
    _child_classes(Runbook::Statements)
  end

  def self.runs
    _child_modules(Runbook::Runs)
  end

  def self.views
    _child_modules(Runbook::Views)
  end

  def self.generators
    _child_classes(Runbook::Generators)
  end

  def self.deprecator
    return @deprecator if @deprecator
    major_version = Gem::Version.new(Runbook::VERSION).segments[0]
    next_major_version = major_version + 1
    @deprecator = ActiveSupport::Deprecation.new(
      "#{next_major_version}.0",
      "Runbook"
    )
  end

  def self._child_classes(mod)
    mod.constants.map { |const|
      "#{mod.to_s}::#{const}".constantize
    }.select { |const| const.is_a?(Class) }
  end

  def self._child_modules(mod)
    mod.constants.map { |const|
      "#{mod.to_s}::#{const}".constantize
    }.select { |const| const.is_a?(Module) }
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
careacademy-runbook-1.2.0 lib/runbook/util/runbook.rb
runbook-1.1.0 lib/runbook/util/runbook.rb
runbook-1.0.0 lib/runbook/util/runbook.rb
runbook-0.16.1 lib/runbook/util/runbook.rb
runbook-0.16.0 lib/runbook/util/runbook.rb