Class: Agave::Local::FieldType::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/agave/local/field_type/theme.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logo, primary_color, dark_color, light_color, accent_color, repo) ⇒ Theme

Returns a new instance of Theme.



18
19
20
21
22
23
24
25
# File 'lib/agave/local/field_type/theme.rb', line 18

def initialize(, primary_color, dark_color, light_color, accent_color, repo)
  @logo = 
  @primary_color = primary_color
  @dark_color = dark_color
  @light_color = light_color
  @accent_color = accent_color
  @repo = repo
end

Instance Attribute Details

#accent_colorObject (readonly)

Returns the value of attribute accent_color.



5
6
7
# File 'lib/agave/local/field_type/theme.rb', line 5

def accent_color
  @accent_color
end

#dark_colorObject (readonly)

Returns the value of attribute dark_color.



5
6
7
# File 'lib/agave/local/field_type/theme.rb', line 5

def dark_color
  @dark_color
end

#light_colorObject (readonly)

Returns the value of attribute light_color.



5
6
7
# File 'lib/agave/local/field_type/theme.rb', line 5

def light_color
  @light_color
end

#primary_colorObject (readonly)

Returns the value of attribute primary_color.



5
6
7
# File 'lib/agave/local/field_type/theme.rb', line 5

def primary_color
  @primary_color
end

Class Method Details

.parse(value, repo) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/agave/local/field_type/theme.rb', line 7

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

#logoObject



27
28
29
# File 'lib/agave/local/field_type/theme.rb', line 27

def 
  @logo && File.parse(@logo, @repo)
end

#to_hash(*args) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/agave/local/field_type/theme.rb', line 31

def to_hash(*args)
  {
    primary_color: primary_color,
    dark_color: dark_color,
    light_color: light_color,
    accent_color: accent_color,
    logo:  && .to_hash(*args)
  }
end