class Nucleo::Models::PageMetric

Constants

METRIC_NAME

Public Class Methods

new(attributes={}) click to toggle source

Returns an instance of the PageRank domain model

@param attributes [Hash]

@return [Nucleo::Models::PageRank]

# File lib/nucleo/models/page_metric.rb, line 11
def initialize(attributes={})
  @attributes = attributes
end

Public Instance Methods

change() click to toggle source

Returns the change

@return [Integer]

# File lib/nucleo/models/page_metric.rb, line 25
def change
  @attributes[translated_key_name(:change)].to_f
end
pct_total() click to toggle source

Returns the pct total

@return [Integer]

# File lib/nucleo/models/page_metric.rb, line 32
def pct_total
  @attributes[translated_key_name(:pct_total)].to_f
end
rank() click to toggle source

Returns the rank

@return [Integer]

# File lib/nucleo/models/page_metric.rb, line 39
def rank
  @attributes[translated_key_name(:rank)].to_i
end
rank_change() click to toggle source

Returns the rank

@return [Integer]

# File lib/nucleo/models/page_metric.rb, line 46
def rank_change
  @attributes[translated_key_name(:rank_change)].to_i
end
value() click to toggle source

Returns the metric value

@return [Integer]

# File lib/nucleo/models/page_metric.rb, line 18
def value
  @attributes[METRIC_NAME].to_i
end

Private Instance Methods

translated_key_name(key) click to toggle source
# File lib/nucleo/models/page_metric.rb, line 51
def translated_key_name(key)
  key = key.to_s

  [METRIC_NAME, key].join('_')
end