Class: RSS::RDF::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/extract_sbm_tags.rb

Constant Summary collapse

SBM_TYPE =
{
  :hatena => Proc.new{|x| x.map{|sbj| sbj.content}},
  :delicious => /\s\s*/,
  :mm => /,\s*/,
  :default => Proc.new{|x| x.map{|sbj| sbj.content.split(/[\s,]\s*/)}.flatten!},
}

Instance Method Summary collapse

Instance Method Details

#extract_sbm_tags(service = :default) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/extract_sbm_tags.rb', line 11

def extract_sbm_tags(service = :default)
  return [] if self.dc_subject.nil?

  service = service.to_sym
  raise "need to specify service name" unless SBM_TYPE.has_key?(service)
  tag = SBM_TYPE[service]

  case tag
  when Proc
    tag.call(self.dc_subjects)
  when Regexp
    self.dc_subject.split(tag)
  end

end