Class: Financial::Revenue

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Revenue

Returns a new instance of Revenue.



4
5
6
7
8
9
10
# File 'lib/financial/revenue.rb', line 4

def initialize(*args)
  args.flatten!
  @method_name = args.shift
  @name = @method_name.to_s.split('_').join(' ').capitalize
  @value = args.shift
  @date = Date.today
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/financial/revenue.rb', line 3

def date
  @date
end

#method_nameObject

Returns the value of attribute method_name.



3
4
5
# File 'lib/financial/revenue.rb', line 3

def method_name
  @method_name
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/financial/revenue.rb', line 3

def name
  @name
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/financial/revenue.rb', line 3

def value
  @value
end

Instance Method Details

#format_valueObject



22
23
24
# File 'lib/financial/revenue.rb', line 22

def format_value
  "+ #{Financial.locale.format_coin(value)}"
end

#in_date(date) ⇒ Object



17
18
19
20
# File 'lib/financial/revenue.rb', line 17

def in_date(date)
  @date = Financial::FinancialDate.new(date).date
  self
end

#is_a_received_deposit?(account) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/financial/revenue.rb', line 26

def is_a_received_deposit?()
  false
end

#tax(*args) ⇒ Object



12
13
14
15
# File 'lib/financial/revenue.rb', line 12

def tax(*args)
  return @tax if args.empty?
  @tax = Tax.new(@method_name, tax_value_for(args))
end