Sha256: 07f95cd74c25a138f1f3013c52a7c5361be3bb7ccb08fbd0f03b0e04c1dc63e6

Contents?: true

Size: 690 Bytes

Versions: 4

Compression:

Stored size: 690 Bytes

Contents

class Photo < PostType
  fields :photo_url, :caption, :url
  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
  
  special :url do |link_content|
    'http://' + link_content.gsub(/^http:\/\//, '')
  end
  
  def self.detect?(text)
    has_required? text
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
myobie-turbine-core-0.3.5 lib/turbine-core/types/photo.rb
myobie-turbine-core-0.3.6 lib/turbine-core/types/photo.rb
myobie-turbine-core-0.3.7 lib/turbine-core/types/photo.rb
myobie-turbine-core-0.4.0 lib/turbine-core/types/photo.rb