Sha256: 9268c6cea7394e5d8e1677bbfd43dba111ee4a866d28ea1f79e06b3ea65ab526

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

module Commandoes
  class IAmACommand
    include ActiveModel::Validations

    module ClassMethods
      def use(plugin, *args, &block)
        unless plugins.include? plugin
          plugins << plugin
          extend  plugin::ClassMethods    if plugin.const_defined? :ClassMethods
          include plugin::InstanceMethods if plugin.const_defined? :InstanceMethods
        end

        self
      end

    private
      def plugins
        @@pluglins ||= []
      end
    end

    extend ClassMethods

    use self
    use Plugins::VirtusPlugin
    use Plugins::ActiveModelPlugin

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
commandoes-0.1.1 lib/commandoes/command.rb