Module: Extractula::OEmbed::ClassMethods

Defined in:
lib/extractula/oembed.rb

Instance Method Summary collapse

Instance Method Details

#oembed_endpoint(url = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/extractula/oembed.rb', line 34

def oembed_endpoint(url = nil)
  if url
    @oembed_endpoint = url
    if @oembed_endpoint.match(/\.(xml|json)$/)
      @oembed_format_param_required = false
      @oembed_endpoint.sub!(/\.xml$/, '.json') if $1 == 'xml'
    else
      @oembed_format_param_required = true
    end
  end
  @oembed_endpoint
end

#oembed_format_param_required?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/extractula/oembed.rb', line 57

def oembed_format_param_required?
  @oembed_format_param_required
end

#oembed_max_height(height = nil) ⇒ Object



52
53
54
55
# File 'lib/extractula/oembed.rb', line 52

def oembed_max_height(height = nil)
  @oembed_max_height = height if height
  @oembed_max_height || OEmbed.max_height
end

#oembed_max_width(width = nil) ⇒ Object



47
48
49
50
# File 'lib/extractula/oembed.rb', line 47

def oembed_max_width(width = nil)
  @oembed_max_width = width if width
  @oembed_max_width || OEmbed.max_width
end