Class: Haml::Util::StaticConditionalContext

Inherits:
Object
  • Object
show all
Defined in:
lib/haml/util.rb

Overview

The context in which the ERB for #def_static_method will be run.

Instance Method Summary collapse

Constructor Details

#initialize(set) ⇒ StaticConditionalContext

Returns a new instance of StaticConditionalContext.

Parameters:

  • set (#include?)

    The set of variables that are defined for this context.



710
711
712
# File 'lib/haml/util.rb', line 710

def initialize(set)
  @set = set
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Boolean

Checks whether or not a variable is defined for this context.

Parameters:

  • name (Symbol)

    The name of the variable

Returns:

  • (Boolean)


718
719
720
721
# File 'lib/haml/util.rb', line 718

def method_missing(name, *args, &block)
  super unless args.empty? && block.nil?
  @set.include?(name)
end