class RubyLint::Template::Scope

Class used for storing variables for an ERB template without polluting the namespace of the code that uses the template.

Public Class Methods

new(variables = {}) click to toggle source

@param [Hash] variables

# File lib/ruby-lint/template/scope.rb, line 11
def initialize(variables = {})
  variables.each do |name, value|
    instance_variable_set("@#{name}", value)
  end
end

Public Instance Methods

get_binding() click to toggle source

@return [Binding]

# File lib/ruby-lint/template/scope.rb, line 32
def get_binding
  return binding # #binding() is a private method.
end
return_instance?(type, name) click to toggle source

Returns `true` if the method's definition should return an instance of the container.

@param [Symbol] type @param [Symbol] name

# File lib/ruby-lint/template/scope.rb, line 24
def return_instance?(type, name)
  return (type == :method && name == :new) ||
    (type == :instance_method && name == :initialize)
end