Sha256: a49afb17c494deeb1abeff0876021022cc10a282406f814198dfdf6fb4954ddc

Contents?: true

Size: 658 Bytes

Versions: 6

Compression:

Stored size: 658 Bytes

Contents

class Lono::Plugin
  module Meta
    extend ActiveSupport::Concern

    included do
      cattr_accessor :meta, default: []
    end

    class_methods do
      def register(o={})
        found = meta.find { |m| m[:name] == o[:name] && m[:type] == o[:type] }
        meta << o unless found
      end

      def find(o={})
        found = meta.find { |m| m[:name] == o[:name] && m[:type] == o[:type] }
        Lono::Plugin.new(found) if found
      end

      def delegate_to_meta(*attrs)
        attrs.each do |attr|
          attr = attr.to_sym
          define_method attr do
            @options[attr]
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc6 lib/lono/plugin/meta.rb
lono-8.0.0.pre.rc5 lib/lono/plugin/meta.rb
lono-8.0.0.pre.rc4 lib/lono/plugin/meta.rb
lono-8.0.0.pre.rc3 lib/lono/plugin/meta.rb
lono-8.0.0.pre.rc2 lib/lono/plugin/meta.rb
lono-8.0.0.pre.rc1 lib/lono/plugin/meta.rb