Module: Tags

Included in:
MyTime::TimeProcesser, Paragraph
Defined in:
lib/docfolio/tags.rb

Overview

handles extraction of tagged or other significant content

Defined Under Namespace

Classes: TagFriend

Constant Summary collapse

TAGS =

interface: extract_date, extract_tags

[:LP, :R, :DEN, :NOTE, :I]
CREDITABLE =

can earn cpd credit

[:LP, :R, :I]
SECTIONS =

assumed from position in document

[:TITLE, :INTRO, :NOTE]
SPECIAL =

internal tags with no meaning from content or position

[:DATE]
ALL_TAGS =
SECTIONS + TAGS + SPECIAL

Instance Method Summary collapse

Instance Method Details

#extract_date(paragraph_text, date) ⇒ Object



155
156
157
# File 'lib/docfolio/tags.rb', line 155

def extract_date(paragraph_text, date)
  TagFriend.new.extract_date(paragraph_text, date)
end

#extract_tags(paragraph_text) ⇒ Object



151
152
153
# File 'lib/docfolio/tags.rb', line 151

def extract_tags(paragraph_text)
  TagFriend.new.extract_tags(paragraph_text)
end

#extract_time_object(hour, min, from) ⇒ Time

Returns the result of hours and minutes after from.

Parameters:

  • from (Time)

    time to which hours and minutes are added

  • hour (Number)

    hours to add to from

  • min (Number)

    minutes to add to from

Returns:

  • (Time)

    the result of hours and minutes after from



146
147
148
149
# File 'lib/docfolio/tags.rb', line 146

def extract_time_object(hour, min, from)
  seconds = (hour.to_i * 3600) + (min.to_i * 60)
  Time.at(from.to_i + seconds)
end