Class: Steep::TypeInference::TypeEnvBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/type_inference/type_env_builder.rb

Defined Under Namespace

Modules: Command

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*commands) ⇒ TypeEnvBuilder

Returns a new instance of TypeEnvBuilder.



127
128
129
# File 'lib/steep/type_inference/type_env_builder.rb', line 127

def initialize(*commands)
  @commands = commands.compact
end

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



125
126
127
# File 'lib/steep/type_inference/type_env_builder.rb', line 125

def commands
  @commands
end

Instance Method Details

#build(type_env) ⇒ Object



131
132
133
134
135
# File 'lib/steep/type_inference/type_env_builder.rb', line 131

def build(type_env)
  commands.inject(type_env) do |env, command|
    command.call(env)
  end
end