Sha256: c85790da73697462b9bfe57f4d39f3fb89475f4a4928135357aa87965b4b5c8b

Contents?: true

Size: 590 Bytes

Versions: 3

Compression:

Stored size: 590 Bytes

Contents

class Photo < PostType
  fields :photo_url, :caption
  required :photo_url
  primary :caption
  
  # special :photo_url do |photo_url_content|
  #   if photo_url_content.blank? && !blank_attr?(:caption)
  #     possible_url = get_attr(:caption).match(/^(http:\/\/.+)\n/)
  #     unless possible_url.blank?
  #       possible_url = possible_url.captures.first
  #       if %w(jpg gif png).include?(possible_url[-3..-1])
  #         set_attr :photo_url, possible_url
  #       end#if
  #     end#unless
  #   end#if
  # end#special
  
  def self.detect?(text)
    has_required? text
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
myobie-turbine-core-0.3.0 lib/turbine-core/types/photo.rb
myobie-turbine-core-0.3.1 lib/turbine-core/types/photo.rb
myobie-turbine-core-0.3.3 lib/turbine-core/types/photo.rb