Module: Nosy

Defined in:
lib/nosy.rb,
lib/nosy/hunter.rb,
lib/nosy/output.rb,
lib/nosy/parser.rb,
lib/nosy/searcher.rb,
lib/nosy/parser/imessage.rb,
lib/nosy/parser/smsmessage.rb,
lib/nosy/output/html_helpers.rb,
lib/nosy/parser/parse_checks.rb,
lib/nosy/parser/message_support.rb

Defined Under Namespace

Classes: Hunter, Output, Parser, Searcher

Class Method Summary collapse

Class Method Details

.can_parse?(file) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/nosy.rb', line 34

def self.can_parse?(file)
  Parser.new.can_parse?(file)
end

.huntObject



8
9
10
# File 'lib/nosy.rb', line 8

def self.hunt
  Hunter.new.hunt
end

.hunt_and_parseObject



12
13
14
# File 'lib/nosy.rb', line 12

def self.hunt_and_parse
  Parser.new.parse(Hunter.new.hunt)
end

.hunt_parse_and_output(output_type = "html", output_to_file = true) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/nosy.rb', line 16

def self.hunt_parse_and_output(output_type="html", output_to_file=true)
  if output_type == "json"
    if output_to_file == true
      Output.new.to_json(parse(Hunter.new.hunt), true)
    else
      Output.new.to_json(parse(Hunter.new.hunt), false)
    end
  elsif output_type == "csv"
    Output.new.to_csv(parse(Hunter.new.hunt))
  else
    Output.new.to_html(parse(Hunter.new.hunt))
  end
end

.new(file) ⇒ Object



30
31
32
# File 'lib/nosy.rb', line 30

def self.new(file)
  Searcher.new(file)
end

.output(texts, output_type = "html", output_to_file = true) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/nosy.rb', line 42

def self.output(texts, output_type="html", output_to_file=true)
  if output_type == "json"
    if output_to_file == true
      Output.new.to_json(texts, true)
    else
      Output.new.to_json(texts, false)
    end
  elsif output_type == "csv"
    Output.new.to_csv(texts)
  else
    Output.new.to_html(texts)
  end
end

.parse(file) ⇒ Object



38
39
40
# File 'lib/nosy.rb', line 38

def self.parse(file)
  Parser.new.parse(file)
end