Module: Concurrency

Defined in:
lib/concurrency.rb,
lib/concurrency/version.rb,
lib/concurrency/configuration.rb

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

VERSION =
"1.0.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



8
9
10
# File 'lib/concurrency.rb', line 8

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



19
20
21
# File 'lib/concurrency.rb', line 19

def self.configure
    yield(configuration)
end

.conversion_rate(from = Concurrency.configuration.from_currency, to = Concurrency.configuration.to_currency) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/concurrency.rb', line 33

def self.conversion_rate(from = Concurrency.configuration.from_currency, to = Concurrency.configuration.to_currency)
    if from == to
        return 1.0
    else
        rate = Concurrency.get_rate(from, to)
        return rate
    end
end

.convert(*args) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/concurrency.rb', line 23

def self.convert(*args)
    if args.length == 3
        Concurrency.convert_full(*args)
    elsif args.length == 2
        Concurrency.convert_full(args[0], Concurrency.configuration.from_currency, args[1])
    else
        Concurrency.convert_full(args[0], Concurrency.configuration.from_currency, Concurrency.configuration.to_currency)
    end
end

.resetObject



15
16
17
# File 'lib/concurrency.rb', line 15

def self.reset
    @configuration = Configuration.new
end