Class: Dato::Local::FieldType::Image
- Defined in:
- lib/dato/local/field_type/image.rb
Instance Attribute Summary collapse
-
#alt ⇒ Object
readonly
Returns the value of attribute alt.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Attributes inherited from File
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, format, size, width, height, alt, title, imgix_host) ⇒ Image
constructor
A new instance of Image.
- #to_hash(*args) ⇒ Object
Methods inherited from File
Constructor Details
#initialize(path, format, size, width, height, alt, title, imgix_host) ⇒ Image
Returns a new instance of Image.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dato/local/field_type/image.rb', line 23 def initialize( path, format, size, width, height, alt, title, imgix_host ) super(path, format, size, imgix_host) @width = width @height = height @alt = alt @title = title end |
Instance Attribute Details
#alt ⇒ Object (readonly)
Returns the value of attribute alt.
8 9 10 |
# File 'lib/dato/local/field_type/image.rb', line 8 def alt @alt end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
8 9 10 |
# File 'lib/dato/local/field_type/image.rb', line 8 def height @height end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/dato/local/field_type/image.rb', line 8 def title @title end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
8 9 10 |
# File 'lib/dato/local/field_type/image.rb', line 8 def width @width end |
Class Method Details
.parse(value, repo) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dato/local/field_type/image.rb', line 10 def self.parse(value, repo) value && new( value[:path], value[:format], value[:size], value[:width], value[:height], value[:alt], value[:title], repo.site.entity.imgix_host ) end |
Instance Method Details
#to_hash(*args) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/dato/local/field_type/image.rb', line 40 def to_hash(*args) super.merge( width: width, height: height, alt: alt, title: title ) end |