Module: Fend::Plugins::Contexts::InstanceMethods

Defined in:
lib/fend/plugins/contexts.rb

Instance Method Summary collapse

Instance Method Details

#context(*values, &block) ⇒ Object



76
77
78
79
80
# File 'lib/fend/plugins/contexts.rb', line 76

def context(*values, &block)
  values = Array(values)

  yield if values.include?(@_context)
end

#initialize(*args) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/fend/plugins/contexts.rb', line 66

def initialize(*args)
  opts = if (_opts = args.last) && _opts.is_a?(Hash)
           _opts
         else
           {}
         end

  @_context = opts.fetch(:context, :default)
end