Class: Tributa::Table::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/tributa/table/row.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns = []) ⇒ Row

Returns a new instance of Row.



7
8
9
10
11
12
13
14
15
# File 'lib/tributa/table/row.rb', line 7

def initialize(columns = [])
  @canton,
  @year,
  @community,
  @canton_rate,
  @community_rate,
  @reformed_rate,
  @catholic_rate = columns
end

Instance Attribute Details

#cantonObject (readonly)

Returns the value of attribute canton.



5
6
7
# File 'lib/tributa/table/row.rb', line 5

def canton
  @canton
end

#canton_rateObject (readonly)

Returns the value of attribute canton_rate.



5
6
7
# File 'lib/tributa/table/row.rb', line 5

def canton_rate
  @canton_rate
end

#catholic_rateObject (readonly)

Returns the value of attribute catholic_rate.



5
6
7
# File 'lib/tributa/table/row.rb', line 5

def catholic_rate
  @catholic_rate
end

#communityObject (readonly)

Returns the value of attribute community.



5
6
7
# File 'lib/tributa/table/row.rb', line 5

def community
  @community
end

#community_rateObject (readonly)

Returns the value of attribute community_rate.



5
6
7
# File 'lib/tributa/table/row.rb', line 5

def community_rate
  @community_rate
end

#reformed_rateObject (readonly)

Returns the value of attribute reformed_rate.



5
6
7
# File 'lib/tributa/table/row.rb', line 5

def reformed_rate
  @reformed_rate
end

#yearObject (readonly)

Returns the value of attribute year.



5
6
7
# File 'lib/tributa/table/row.rb', line 5

def year
  @year
end

Instance Method Details

#as_jsonObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tributa/table/row.rb', line 17

def as_json
  {
    canton: canton,
    year: year,
    community: community,
    canton_rate: canton_rate,
    community_rate: community_rate,
    reformed_rate: reformed_rate,
    catholic_rate: catholic_rate
  }
end

#to_jsonObject



29
30
31
# File 'lib/tributa/table/row.rb', line 29

def to_json
  as_json.to_json
end