Class: Alpr

Inherits:
Object
  • Object
show all
Defined in:
lib/alpr.rb,
lib/alpr/version.rb

Constant Summary collapse

VERSION =
'0.1.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, region = :detect, pattern = nil, max = 10, glob = false) ⇒ Alpr

Returns a new instance of Alpr.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/alpr.rb', line 11

def initialize(file, region=:detect, pattern=nil, max=10, glob=false)
  @file = file
  @region = region
  @pattern = pattern
  @max = max
  @glob = glob

  @output = []
  begin
    if @glob
      Dir.glob(glob).each do |picture|
        @output.push JSON.parse(check_file(picture))
      end
    else
      @output = JSON.parse(check_file(file))
    end
  rescue JSON::ParserError
    @output = nil
  end
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



9
10
11
# File 'lib/alpr.rb', line 9

def command
  @command
end

#globObject (readonly)

Returns the value of attribute glob.



9
10
11
# File 'lib/alpr.rb', line 9

def glob
  @glob
end

#maxObject (readonly)

Returns the value of attribute max.



9
10
11
# File 'lib/alpr.rb', line 9

def max
  @max
end

#outputObject (readonly)

Returns the value of attribute output.



9
10
11
# File 'lib/alpr.rb', line 9

def output
  @output
end

#patternObject (readonly)

Returns the value of attribute pattern.



9
10
11
# File 'lib/alpr.rb', line 9

def pattern
  @pattern
end

#regionObject (readonly)

Returns the value of attribute region.



9
10
11
# File 'lib/alpr.rb', line 9

def region
  @region
end