Class: Infold::ActiveStorage
- Inherits:
-
Object
- Object
- Infold::ActiveStorage
- Includes:
- ActiveModel::Model
- Defined in:
- lib/infold/property/active_storage.rb
Defined Under Namespace
Classes: ActiveStorageThumb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#thumb ⇒ Object
Returns the value of attribute thumb.
Instance Method Summary collapse
- #build_thumb(**attrs) ⇒ Object
-
#initialize(field, **attrs) ⇒ ActiveStorage
constructor
A new instance of ActiveStorage.
- #kind_file? ⇒ Boolean
- #kind_image? ⇒ Boolean
- #thumb? ⇒ Boolean
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
#field ⇒ Object (readonly)
Returns the value of attribute field.
5 6 7 |
# File 'lib/infold/property/active_storage.rb', line 5 def field @field end |
#kind ⇒ Object
Returns the value of attribute kind.
6 7 8 |
# File 'lib/infold/property/active_storage.rb', line 6 def kind @kind end |
#thumb ⇒ Object
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
22 23 24 |
# File 'lib/infold/property/active_storage.rb', line 22 def kind_file? !kind_image? end |
#kind_image? ⇒ Boolean
18 19 20 |
# File 'lib/infold/property/active_storage.rb', line 18 def kind_image? kind.to_s == 'image' end |
#thumb? ⇒ Boolean
26 27 28 |
# File 'lib/infold/property/active_storage.rb', line 26 def thumb? @thumb.present? end |