Class: BooticCli::Themes::FSTheme::ThemeAsset

Inherits:
Struct
  • Object
show all
Defined in:
lib/bootic_cli/themes/fs_theme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



15
16
17
# File 'lib/bootic_cli/themes/fs_theme.rb', line 15

def file
  @file
end

#file_nameObject

Returns the value of attribute file_name

Returns:

  • (Object)

    the current value of file_name



15
16
17
# File 'lib/bootic_cli/themes/fs_theme.rb', line 15

def file_name
  @file_name
end

#updated_onObject

Returns the value of attribute updated_on

Returns:

  • (Object)

    the current value of 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
# File 'lib/bootic_cli/themes/fs_theme.rb', line 20

def ==(other)
  if other.digest.to_s == '' # api theme asset without a digest set
    return self.updated_on == other.updated_on
  end

  self.file_size == other.file_size && self.digest == other.digest
end

#bodyObject



16
# File 'lib/bootic_cli/themes/fs_theme.rb', line 16

def body; @body ||= file.read; end

#digestObject



18
# File 'lib/bootic_cli/themes/fs_theme.rb', line 18

def digest; @digest ||= Digest::MD5.hexdigest(body); end

#file_sizeObject



17
# File 'lib/bootic_cli/themes/fs_theme.rb', line 17

def file_size; body.length; end