Class: MartialArts::Countries
- Inherits:
-
Object
- Object
- MartialArts::Countries
- Defined in:
- lib/martial_arts/countries.rb
Constant Summary collapse
- @@unfiltered =
[]
- @@filtered =
[]
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
-
.country_list ⇒ Object
def styles @styles styles method not needed, but fulfills country has many styles relationship end.
- .filtered ⇒ Object
- .unfiltered ⇒ Object
Instance Method Summary collapse
- #add_style(style) ⇒ Object
-
#initialize(name) ⇒ Countries
constructor
A new instance of Countries.
Constructor Details
#initialize(name) ⇒ Countries
Returns a new instance of Countries.
7 8 9 10 |
# File 'lib/martial_arts/countries.rb', line 7 def initialize(name) @name = name @styles = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/martial_arts/countries.rb', line 3 def name @name end |
Class Method Details
.country_list ⇒ Object
def styles
@styles styles method not needed, but fulfills country has many styles relationship
end
21 22 23 |
# File 'lib/martial_arts/countries.rb', line 21 def self.country_list self.filtered.uniq.sort {|a,b| a <=> b } end |
.filtered ⇒ Object
25 26 27 28 |
# File 'lib/martial_arts/countries.rb', line 25 def self.filtered #styles from the list of martial arts wikipedia page, easer to acces but not as much info @@filtered end |
.unfiltered ⇒ Object
30 31 32 33 |
# File 'lib/martial_arts/countries.rb', line 30 def self.unfiltered #countries from the style's wikipedia page, has more info but harder to access if not specific @@unfiltered end |
Instance Method Details
#add_style(style) ⇒ Object
12 13 14 15 |
# File 'lib/martial_arts/countries.rb', line 12 def add_style(style) @styles << style style.country = self end |