Module: Kernel

Defined in:
lib/lib/helper/lib/kernel.rb

Instance Method Summary collapse

Instance Method Details

#fn(*funs) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/lib/helper/lib/kernel.rb', line 2

def fn(*funs)
  -> x do
    funs.inject(x) do |v,f|
      Proc === f ? f.call(v) : v.send(f)
    end
  end
end

#prompt(text = '', conversion = nil) ⇒ Object



9
10
11
12
13
# File 'lib/lib/helper/lib/kernel.rb', line 9

def prompt(text='', conversion=nil)
  print text unless text.empty?
  input = gets.chomp
  CONVERSIONS.include?(conversion) ? input.send(conversion) : input
end

#with(object, &block) ⇒ Object



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

def with(object,&block)
  object.instance_eval(&block)
end