Class: Semistatic::Part
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Semistatic::Part
- Defined in:
- app/models/semistatic/part.rb
Instance Method Summary collapse
-
#is_file? ⇒ Boolean
is this a file?.
-
#is_image? ⇒ Boolean
is this is an image?.
-
#options=(options) ⇒ Object
force options to be a HashWithIndifferentAccess.
-
#type ⇒ Object
Symbol.
- #valid_content_type ⇒ Object
Instance Method Details
#is_file? ⇒ Boolean
is this a file?
27 28 29 |
# File 'app/models/semistatic/part.rb', line 27 def is_file? is_image? || type == :file end |
#is_image? ⇒ Boolean
is this is an image?
22 23 24 |
# File 'app/models/semistatic/part.rb', line 22 def is_image? type == :image end |
#options=(options) ⇒ Object
force options to be a HashWithIndifferentAccess
38 39 40 41 42 43 |
# File 'app/models/semistatic/part.rb', line 38 def () if .respond_to? :deep_symbolize_keys = .deep_symbolize_keys end write_attribute(:options, ) end |
#type ⇒ Object
Returns Symbol.
32 33 34 |
# File 'app/models/semistatic/part.rb', line 32 def type [:type].to_sym if [:type] end |
#valid_content_type ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/models/semistatic/part.rb', line 46 def valid_content_type if is_image? ['image/jpg', 'image/png', 'image/gif'] else [] end end |