class CobwebModule::CrawlObject

Public Class Methods

new(content_hash, options={}) click to toggle source
# File lib/crawl_object.rb, line 4
def initialize(content_hash, options={})
  @content = HashUtil.deep_symbolize_keys(content_hash)
  @options = options
end

Public Instance Methods

method_missing(m) click to toggle source
Calls superclass method
# File lib/crawl_object.rb, line 18
def method_missing(m)
  if @content.keys.include? m.to_sym
    @content[m.to_sym]
  else
    super
  end
end
permitted_type?() click to toggle source

Helper method to determine if this content is to be processed or not

# File lib/crawl_object.rb, line 11
def permitted_type?
  @options[:valid_mime_types].each do |valid_mime_type|
    return true if @content[:mime_type].match(Cobweb.escape_pattern_for_regex(valid_mime_type))
  end
  false
end
to_hash() click to toggle source
# File lib/crawl_object.rb, line 26
def to_hash
  @content
end