Class: DeadSimpleCMS::Attribute::Type::Image

Inherits:
File
  • Object
show all
Defined in:
lib/dead_simple_cms/attribute/type/all.rb

Constant Summary

Constants inherited from Base

Base::VALID_INPUT_TYPES

Instance Attribute Summary collapse

Attributes inherited from File

#data, #file_ext

Attributes inherited from Base

#group_hierarchy, #input_type, #required, #section

Instance Method Summary collapse

Methods inherited from File

#upload!

Methods inherited from Base

#default, #inspect, #length, #root_group?, #section_identifier, #value, #value=

Constructor Details

#initialize(identifier, options = {}) ⇒ Image

Returns a new instance of Image.



123
124
125
126
# File 'lib/dead_simple_cms/attribute/type/all.rb', line 123

def initialize(identifier, options={})
  @width, @height = options.values_at(:width, :height)
  super
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



121
122
123
# File 'lib/dead_simple_cms/attribute/type/all.rb', line 121

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



121
122
123
# File 'lib/dead_simple_cms/attribute/type/all.rb', line 121

def width
  @width
end

Instance Method Details

#hintObject



128
129
130
# File 'lib/dead_simple_cms/attribute/type/all.rb', line 128

def hint
  super || "Image should be #{width} x #{height}."
end