Class: Dato::Local::FieldType::Theme
- Inherits:
-
Object
- Object
- Dato::Local::FieldType::Theme
- Defined in:
- lib/dato/local/field_type/theme.rb
Instance Attribute Summary collapse
-
#accent_color ⇒ Object
readonly
Returns the value of attribute accent_color.
-
#dark_color ⇒ Object
readonly
Returns the value of attribute dark_color.
-
#light_color ⇒ Object
readonly
Returns the value of attribute light_color.
-
#primary_color ⇒ Object
readonly
Returns the value of attribute primary_color.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(logo, primary_color, dark_color, light_color, accent_color, repo) ⇒ Theme
constructor
A new instance of Theme.
- #logo ⇒ Object
- #to_hash(*args) ⇒ Object
Constructor Details
#initialize(logo, primary_color, dark_color, light_color, accent_color, repo) ⇒ Theme
Returns a new instance of Theme.
20 21 22 23 24 25 26 27 |
# File 'lib/dato/local/field_type/theme.rb', line 20 def initialize(logo, primary_color, dark_color, light_color, accent_color, repo) @logo = logo @primary_color = primary_color @dark_color = dark_color @light_color = light_color @accent_color = accent_color @repo = repo end |
Instance Attribute Details
#accent_color ⇒ Object (readonly)
Returns the value of attribute accent_color.
7 8 9 |
# File 'lib/dato/local/field_type/theme.rb', line 7 def accent_color @accent_color end |
#dark_color ⇒ Object (readonly)
Returns the value of attribute dark_color.
7 8 9 |
# File 'lib/dato/local/field_type/theme.rb', line 7 def dark_color @dark_color end |
#light_color ⇒ Object (readonly)
Returns the value of attribute light_color.
7 8 9 |
# File 'lib/dato/local/field_type/theme.rb', line 7 def light_color @light_color end |
#primary_color ⇒ Object (readonly)
Returns the value of attribute primary_color.
7 8 9 |
# File 'lib/dato/local/field_type/theme.rb', line 7 def primary_color @primary_color end |
Class Method Details
.parse(value, repo) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dato/local/field_type/theme.rb', line 9 def self.parse(value, repo) value && new( value[:logo], value[:primary_color], value[:dark_color], value[:light_color], value[:accent_color], repo, ) end |
Instance Method Details
#logo ⇒ Object
29 30 31 |
# File 'lib/dato/local/field_type/theme.rb', line 29 def logo @logo && UploadId.parse(@logo, @repo) end |
#to_hash(*args) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/dato/local/field_type/theme.rb', line 33 def to_hash(*args) { primary_color: primary_color, dark_color: dark_color, light_color: light_color, accent_color: accent_color, logo: logo && logo.to_hash(*args), } end |