Module: Naplug::ClassMethods

Includes:
Helpers::Grokkers
Defined in:
lib/naplug.rb

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Helpers::Grokkers

#tagmeta_grok

Class Attribute Details

._timeObject (readonly)

Returns the value of attribute _time.



30
31
32
# File 'lib/naplug.rb', line 30

def _time
  @_time
end

.pluginsHash<Symbol, Plugin> (readonly)

Returns metaplugins.

Returns:

  • (Hash<Symbol, Plugin>)

    metaplugins



30
31
32
# File 'lib/naplug.rb', line 30

def plugins
  @plugins
end

Class Method Details

.meta(m) ⇒ Object



44
45
46
# File 'lib/naplug.rb', line 44

def meta(m)
  @_time = { :start => Time.now } #  if m[:benchmark]
end

.plugin(*tagmeta, &block) ⇒ Plugin

Create a metaplugin (which basically contains a tag and a block)

Parameters:

  • tag (Symbol)

    the plugin tag

Returns:



35
36
37
38
39
40
41
42
# File 'lib/naplug.rb', line 35

def plugin(*tagmeta, &block)
  tag, meta = tagmeta_grok tagmeta
  @metas = Hash.new unless @metas
  @metas[tag] = Meta.new meta.merge :meta => true
  @plugins = Hash.new unless @plugins
  @plugins[tag] = create_metaplugin tag, meta, block
  @_time = { :start => Time.now } #  if m[:benchmark]
end

.tagsArray<Symbol>

A list of plugin tags

Returns:

  • (Array<Symbol>)

    the list of plugin tags



50
51
52
# File 'lib/naplug.rb', line 50

def tags
  self.plugins.keys
end