Class: Snafu::Models::Achievement
- Inherits:
-
Object
- Object
- Snafu::Models::Achievement
- Defined in:
- lib/snafu/models/achievement.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
(also: #desc)
readonly
Returns the value of attribute description.
-
#image_180 ⇒ Object
readonly
Returns the value of attribute image_180.
-
#image_60 ⇒ Object
readonly
Returns the value of attribute image_60.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Achievement
constructor
A new instance of Achievement.
- #parse_image(image) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Achievement
Returns a new instance of Achievement.
6 7 8 9 10 11 12 |
# File 'lib/snafu/models/achievement.rb', line 6 def initialize( = {}) @name = ["name"] @description = ["description"] || ["desc"] @url = ["url"] @image_60 = parse_image ["image_60"] @image_180 = parse_image ["image_180"] end |
Instance Attribute Details
#description ⇒ Object (readonly) Also known as: desc
Returns the value of attribute description.
4 5 6 |
# File 'lib/snafu/models/achievement.rb', line 4 def description @description end |
#image_180 ⇒ Object (readonly)
Returns the value of attribute image_180.
4 5 6 |
# File 'lib/snafu/models/achievement.rb', line 4 def image_180 @image_180 end |
#image_60 ⇒ Object (readonly)
Returns the value of attribute image_60.
4 5 6 |
# File 'lib/snafu/models/achievement.rb', line 4 def image_60 @image_60 end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/snafu/models/achievement.rb', line 4 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/snafu/models/achievement.rb', line 4 def url @url end |
Instance Method Details
#parse_image(image) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/snafu/models/achievement.rb', line 14 def parse_image(image) if image.is_a? String return GlitchImage.new(url: image) elsif image.is_a? GlitchImage return image end nil end |