Sha256: 1083f3a2a135f9cf05cdeb13278efdc6afe738435c43f409917e60fb5f32a1a9
Contents?: true
Size: 752 Bytes
Versions: 8
Compression:
Stored size: 752 Bytes
Contents
require "metamorpher/terms/variable" module Metamorpher module Builders module AST class VariableBuilder def variable!(name, &block) if block Terms::Variable.new(name: name, condition: block) else Terms::Variable.new(name: name) end end def shorthand?(method, *_arguments, &_block) !method[/\p{Lower}/] && !method.to_s.end_with?("_") end def method_missing(method, *arguments, &block) if shorthand?(method, *arguments, &block) variable!(method.downcase.to_sym, *arguments, &block) else super.method_missing(method, *arguments, &block) end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems