Class: Haml::Util::StaticConditionalContext

Inherits:
Object
  • Object
show all
Defined in:
/var/www/haml-pages/.haml/lib/haml/util.rb

Overview

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

Instance Method Summary

Constructor Details

- (StaticConditionalContext) initialize(set)

A new instance of StaticConditionalContext

Parameters:

  • (#include?) set — The set of variables that are defined for this context.


711
712
713
# File '/var/www/haml-pages/.haml/lib/haml/util.rb', line 711

def initialize(set)
  @set = set
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

- (Boolean) method_missing(name, *args, &block)

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

Parameters:

  • (Symbol) name — The name of the variable

Returns:

  • (Boolean)


719
720
721
722
# File '/var/www/haml-pages/.haml/lib/haml/util.rb', line 719

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