Class: TVTid::Category
- Inherits:
-
Object
- Object
- TVTid::Category
- Defined in:
- library/tvtid/category.rb
Overview
A category for an EPG entry.
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#shade ⇒ Object
Returns the value of attribute shade.
Class Method Summary collapse
-
.from_json(json) ⇒ Object
Creates a new category from a json object.
Instance Method Summary collapse
-
#initialize(name) ⇒ Category
constructor
Constructs a new category with a name.
Constructor Details
#initialize(name) ⇒ Category
Constructs a new category with a name.
10 11 12 |
# File 'library/tvtid/category.rb', line 10 def initialize name @name = name end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
6 7 8 |
# File 'library/tvtid/category.rb', line 6 def color @color end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'library/tvtid/category.rb', line 7 def name @name end |
#shade ⇒ Object
Returns the value of attribute shade.
6 7 8 |
# File 'library/tvtid/category.rb', line 6 def shade @shade end |
Class Method Details
.from_json(json) ⇒ Object
Creates a new category from a json object.
17 18 19 20 21 22 23 24 |
# File 'library/tvtid/category.rb', line 17 def self.from_json json return nil unless json['name'] Category.new(json['name']).tap do |category| category.color = json['color'] category.shade = json['shade'] end end |