Module: AdSense::AdFormat

Defined in:
lib/ad_sense/ad_format.rb

Constant Summary collapse

LargeLeaderBoard =
"970x90"
MediumRectangle =
"300x250"
LargeSkyscraper =
"300x600"
SmallRrectangle =
"180x150"
LargeRectangle =
"336x280"
VerticalBanner =
"120x240"
WideSkyscraper =
"160x600"
MobileBanner =
"320x50"
LeaderBoard =
"728x90"
SmallSquare =
"200x200"
Skyscraper =
"120x600"
HalfBanner =
"234x60"
"468x60"
Square =
"250x250"
Button =
"125x125"

Class Method Summary collapse

Class Method Details

.ad_format_string(format, is_links_ad = false) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/ad_sense/ad_format.rb', line 29

def ad_format_string(format, is_links_ad = false)
  format_value = get_format_value(format)

  if format_value.present?
    prepend_string = is_links_ad ? '_0ads_al' : '_as'
    "#{format_value}#{prepend_string}"
  end
end

.available_formatsObject



38
39
40
# File 'lib/ad_sense/ad_format.rb', line 38

def available_formats
  AdFormat.constants.map { |format| format.to_s.underscore.to_sym }
end

.get_dimension(format) ⇒ Object



22
23
24
25
26
27
# File 'lib/ad_sense/ad_format.rb', line 22

def get_dimension(format)
  format_value = get_format_value(format)
  format_value.split('x').map(&:to_i)
rescue NameError
  []
end