Class: CbNitride::DiamondNumberFormatter

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(year: year, month: month, num: num) ⇒ DiamondNumberFormatter

Returns a new instance of DiamondNumberFormatter.



9
10
11
12
13
# File 'lib/cb_nitride/diamond_number_formatter.rb', line 9

def initialize(year: year, month: month, num: num)
  @year = year
  @month = month
  @num = num
end

Instance Attribute Details

#monthObject (readonly)

Returns the value of attribute month.



3
4
5
# File 'lib/cb_nitride/diamond_number_formatter.rb', line 3

def month
  @month
end

#numObject (readonly)

Returns the value of attribute num.



3
4
5
# File 'lib/cb_nitride/diamond_number_formatter.rb', line 3

def num
  @num
end

#yearObject (readonly)

Returns the value of attribute year.



3
4
5
# File 'lib/cb_nitride/diamond_number_formatter.rb', line 3

def year
  @year
end

Class Method Details

.format(year: year, month: month, num: num) ⇒ Object



5
6
7
# File 'lib/cb_nitride/diamond_number_formatter.rb', line 5

def self.format(year: year, month: month, num: num)
  new(year: year, month: month, num: num).format
end

Instance Method Details

#formatObject



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

def format
  month + year + calculate_zeroes
end