Class: BooticCli::Themes::FSTheme::ThemeAsset
- Inherits:
-
Struct
- Object
- Struct
- BooticCli::Themes::FSTheme::ThemeAsset
- Defined in:
- lib/bootic_cli/themes/fs_theme.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#updated_on ⇒ Object
Returns the value of attribute updated_on.
Instance Method Summary collapse
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file
15 16 17 |
# File 'lib/bootic_cli/themes/fs_theme.rb', line 15 def file @file end |
#file_name ⇒ Object
Returns the value of attribute file_name
15 16 17 |
# File 'lib/bootic_cli/themes/fs_theme.rb', line 15 def file_name @file_name end |
#updated_on ⇒ Object
Returns the value of attribute updated_on
15 16 17 |
# File 'lib/bootic_cli/themes/fs_theme.rb', line 15 def updated_on @updated_on end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bootic_cli/themes/fs_theme.rb', line 20 def ==(other) if other.digest.to_s == '' # api theme asset without a digest set # puts "Other has no digest, so comparing dates: #{self.updated_on.to_i} vs #{other.updated_on.to_i}" return self.updated_on.to_i == other.updated_on.to_i end # file sizes may differ as they are served by CDN (that shrinks them) # puts "Comparing FSTheme vs other digest:\n#{digest}\n#{other.digest}" self.digest == other.digest # self.file_size == other.file_size end |
#body ⇒ Object
16 |
# File 'lib/bootic_cli/themes/fs_theme.rb', line 16 def body; @body ||= file.read; end |
#digest ⇒ Object
18 |
# File 'lib/bootic_cli/themes/fs_theme.rb', line 18 def digest; @digest ||= Digest::MD5.hexdigest(body); end |
#file_size ⇒ Object
17 |
# File 'lib/bootic_cli/themes/fs_theme.rb', line 17 def file_size; body.length; end |