Class: Nanowrimo::Region

Inherits:
Core
  • Object
show all
Defined in:
lib/nanowrimo/region.rb

Overview

Handles Nanowrimo Region data.

Constant Summary collapse

FIELDS =

fields expected from the main Region WCAPI

%w[rid rname region_wordcount max min stddev average count donations numdonors]
HISTORY_FIELDS =

fields expected from the Region history WCAPI

%w[wc wcdate max min stddev average count donations donors]

Instance Attribute Summary collapse

Attributes inherited from Core

#error

Instance Method Summary collapse

Methods inherited from Core

#has_error?, #load, #load_history

Constructor Details

#initialize(rid) ⇒ Region

creates a new Region object



13
14
15
# File 'lib/nanowrimo/region.rb', line 13

def initialize(rid)
  @rid = rid
end

Instance Attribute Details

#historyObject

Returns the value of attribute history.



11
12
13
# File 'lib/nanowrimo/region.rb', line 11

def history
  @history
end

Instance Method Details

#idObject

converts the WCAPI unique identifier for this type into a Nanowrimo::Core-friendly ‘id’



18
19
20
# File 'lib/nanowrimo/region.rb', line 18

def id
  @rid
end

#load_fieldObject

converts the WCAPI path for this type into something Nanowrimo::Core-friendly



23
24
25
# File 'lib/nanowrimo/region.rb', line 23

def load_field
  'wcregion'
end

#load_history_fieldObject

converts the WCAPI history path for this type into something Nanowrimo::Core-friendly



28
29
30
# File 'lib/nanowrimo/region.rb', line 28

def load_history_field
  'wcregionhist/wordcounts/wcentry'
end