Class: Taeval::Plagium::Config

Inherits:
Object
  • Object
show all
Includes:
FileHelper
Defined in:
lib/taeval/plagium/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileHelper

#create, #exist?, #flatten_include!, #open, #path_of

Constructor Details

#initialize(conf_h) ⇒ Config

Returns a new instance of Config.



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

def initialize(conf_h)
  @id               = conf_h.fetch('id', '')
  @language         = conf_h.fetch('language', 'ascii')
  @max_matches      = conf_h.fetch('max_matches', 10)
  @show_num_matches = conf_h.fetch('show_num_matches', 250)
  @comment          = conf_h.fetch('comment', '')
  
  output_path       = conf_h.fetch('output', '')
  @output           = File.new(path_of(output_path), 'w') 

  @reject           = conf_h.fetch('reject', '') 
  @solutions        = path_of(conf_h.dig('solution', 'path'))
  if !File.exist?(@solutions)
    raise "Plagium: Path of input solutions not exists: #{@solutions}"
  end

end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



7
8
9
# File 'lib/taeval/plagium/config.rb', line 7

def comment
  @comment
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/taeval/plagium/config.rb', line 7

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



7
8
9
# File 'lib/taeval/plagium/config.rb', line 7

def language
  @language
end

#max_matchesObject (readonly)

Returns the value of attribute max_matches.



7
8
9
# File 'lib/taeval/plagium/config.rb', line 7

def max_matches
  @max_matches
end

#outputObject (readonly)

Returns the value of attribute output.



7
8
9
# File 'lib/taeval/plagium/config.rb', line 7

def output
  @output
end

#rejectObject (readonly)

Returns the value of attribute reject.



7
8
9
# File 'lib/taeval/plagium/config.rb', line 7

def reject
  @reject
end

#show_num_matchesObject (readonly)

Returns the value of attribute show_num_matches.



7
8
9
# File 'lib/taeval/plagium/config.rb', line 7

def show_num_matches
  @show_num_matches
end

#solutionsObject (readonly)

Returns the value of attribute solutions.



7
8
9
# File 'lib/taeval/plagium/config.rb', line 7

def solutions
  @solutions
end