Class: Dato::Local::FieldType::File
- Inherits:
-
Object
- Object
- Dato::Local::FieldType::File
- Defined in:
- lib/dato/local/field_type/file.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
- #file ⇒ Object
-
#initialize(path, format, size) ⇒ File
constructor
A new instance of File.
- #url(*args) ⇒ Object
Constructor Details
#initialize(path, format, size) ⇒ File
Returns a new instance of File.
18 19 20 21 22 |
# File 'lib/dato/local/field_type/file.rb', line 18 def initialize(path, format, size) @path = path @format = format @size = size end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
8 9 10 |
# File 'lib/dato/local/field_type/file.rb', line 8 def format @format end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/dato/local/field_type/file.rb', line 8 def path @path end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
8 9 10 |
# File 'lib/dato/local/field_type/file.rb', line 8 def size @size end |
Class Method Details
.parse(value, _repo) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/dato/local/field_type/file.rb', line 10 def self.parse(value, _repo) new( value[:path], value[:format], value[:size] ) end |
Instance Method Details
#file ⇒ Object
24 25 26 27 28 29 |
# File 'lib/dato/local/field_type/file.rb', line 24 def file Imgix::Client.new( host: 'dato-images.imgix.net', secure: true ).path(path) end |
#url(*args) ⇒ Object
31 32 33 |
# File 'lib/dato/local/field_type/file.rb', line 31 def url(*args) file.to_url(*args) end |