Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/hashrush.rb

Class Method Summary collapse

Class Method Details

.build_from_symbol_variables(binding, *args) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/hashrush.rb', line 4

def self.build_from_symbol_variables(binding, *args)
  hash = Hash.new
  args = args.flatten if args.class == Array
  args.each do |arg|
    raise "Argments must all be symbols!" unless arg.class == Symbol
    hash[arg] = binding.eval("#{arg.to_s}")# if is_variable?(arg)
  end
  return hash
end

.rush(binding, *args) ⇒ Object



14
15
16
# File 'lib/hashrush.rb', line 14

def self.rush(binding, *args)
  Hash.build_from_symbol_variables(binding, args)
end