Class: Omnibar::Calculate

Inherits:
Query
  • Object
show all
Includes:
Math
Defined in:
lib/omnibar/calculate.rb

Instance Attribute Summary

Attributes inherited from Query

#input

Instance Method Summary collapse

Methods inherited from Query

#copy_to_clipboard, inherited, #initialize, #open_in_browser, #preview_text

Constructor Details

This class inherits a constructor from Omnibar::Query

Instance Method Details

#eObject



24
25
26
# File 'lib/omnibar/calculate.rb', line 24

def e
  E
end

#perform!Object



16
17
18
# File 'lib/omnibar/calculate.rb', line 16

def perform!
  copy_to_clipboard value
end

#piObject



20
21
22
# File 'lib/omnibar/calculate.rb', line 20

def pi
  PI
end

#resultObject



5
6
7
8
9
10
# File 'lib/omnibar/calculate.rb', line 5

def result
  begin
    [input, value].join(' = ')
  rescue Exception => _e
  end
end

#valueObject



12
13
14
# File 'lib/omnibar/calculate.rb', line 12

def value
  eval(input + '.to_f')
end