Class: Infold::ActiveStorage

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/infold/property/active_storage.rb

Defined Under Namespace

Classes: ActiveStorageThumb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, **attrs) ⇒ ActiveStorage

Returns a new instance of ActiveStorage.



9
10
11
12
# File 'lib/infold/property/active_storage.rb', line 9

def initialize(field, **attrs)
  @field = field
  super(attrs)
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



5
6
7
# File 'lib/infold/property/active_storage.rb', line 5

def field
  @field
end

#kindObject

Returns the value of attribute kind.



6
7
8
# File 'lib/infold/property/active_storage.rb', line 6

def kind
  @kind
end

#thumbObject

Returns the value of attribute thumb.



6
7
8
# File 'lib/infold/property/active_storage.rb', line 6

def thumb
  @thumb
end

Instance Method Details

#build_thumb(**attrs) ⇒ Object



14
15
16
# File 'lib/infold/property/active_storage.rb', line 14

def build_thumb(**attrs)
  @thumb = ActiveStorageThumb.new(**attrs)
end

#kind_file?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/infold/property/active_storage.rb', line 22

def kind_file?
  !kind_image?
end

#kind_image?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/infold/property/active_storage.rb', line 18

def kind_image?
  kind.to_s == 'image'
end

#thumb?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/infold/property/active_storage.rb', line 26

def thumb?
  @thumb.present?
end