Class: AhoyCaptain::RegionDecorator

Inherits:
CountryDecorator show all
Defined in:
app/decorators/ahoy_captain/region_decorator.rb

Constant Summary

Constants inherited from CountryDecorator

CountryDecorator::EMOJI_MAP

Instance Attribute Summary

Attributes inherited from ApplicationDecorator

#object

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CountryDecorator

#label

Methods inherited from ApplicationDecorator

#initialize, to_csv

Constructor Details

This class inherits a constructor from AhoyCaptain::ApplicationDecorator

Class Method Details

.csv_map(params = {}) ⇒ Object



3
4
5
6
7
8
9
# File 'app/decorators/ahoy_captain/region_decorator.rb', line 3

def self.csv_map(params = {})
  {
    "Country" => :country,
    "Region" => :region,
    "Total" => :unit_amount
  }
end

Instance Method Details

#countryObject



16
17
18
# File 'app/decorators/ahoy_captain/region_decorator.rb', line 16

def country
  "#{country_emoji(object.country)} #{object.country}"
end

#display_nameObject



11
12
13
14
# File 'app/decorators/ahoy_captain/region_decorator.rb', line 11

def display_name
  search = search_query(region_eq: object.region, country_eq: object.country)
  frame_link("#{country_emoji(object.country)} #{object.region}", search)
end

#regionObject



20
21
22
# File 'app/decorators/ahoy_captain/region_decorator.rb', line 20

def region
  object.region
end

#unit_amountObject



24
25
26
# File 'app/decorators/ahoy_captain/region_decorator.rb', line 24

def unit_amount
  object.count
end