class JadePug::Config

Defines template engine compiler configuration.

Public Instance Methods

method_missing(name, *args, &block) click to toggle source

Allows to dynamically set config attributes.

Calls superclass method
# File lib/jade-pug/config.rb, line 14
def method_missing(name, *args, &block)
  return super if block

  case args.size
    when 0

      # config.client?
      if name =~ /\A(\w+)\?\z/
        !!(respond_to?($1) ? send($1) : instance_variable_get("@#{ $1 }"))

      # config.client
      elsif name =~ /\A(\w+)\z/
        instance_variable_get("@#{ $1 }")

      else
        super
      end

    when 1
      # config.client=
      if name =~ /\A(\w+)=\z/
        instance_variable_set("@#{ $1 }", args.first)
      else
        super
      end
    else
      super
  end
end
respond_to_missing?(name, include_all) click to toggle source
# File lib/jade-pug/config.rb, line 44
def respond_to_missing?(name, include_all)
  name.match?(/\A\w+[=?]?\z/)
end
to_h()
Alias for: to_hash
to_hash() click to toggle source

Transforms config to the hash with all keys symbolized.

@return [Hash]

# File lib/jade-pug/config.rb, line 52
def to_hash
  instance_variables.each_with_object({}) do |var, h|
    h[var[1..-1].to_sym] = instance_variable_get(var)
  end
end
Also aliased as: to_h