protokoll 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +0,0 @@
1
- module Protokoll
2
- module ExtractNumber
3
- def self.create_number_mask(format)
4
- format.split("").map do |i|
5
- (i == "#") ? 1 : 0
6
- end
7
- end
8
-
9
- def self.extract_using_mask(db_number, mask)
10
- result = db_number.split("").select.with_index do |n, i|
11
- n if mask[i] == 1
12
- end
13
- result.join.to_i
14
- end
15
-
16
- def self.number(str, pattern)
17
- mask = create_number_mask( expand_pattern(pattern) )
18
- extract_using_mask(str, mask)
19
- end
20
-
21
- def self.expand_pattern(pattern)
22
- pattern.sub("%Y", "0000")
23
- end
24
- end
25
- end
@@ -1,3 +0,0 @@
1
- class Call < ActiveRecord::Base
2
- protokoll :number
3
- end
@@ -1,2 +0,0 @@
1
- class Principal < ActiveRecord::Base
2
- end
@@ -1,3 +0,0 @@
1
- class Protocol < ActiveRecord::Base
2
- protokoll :number
3
- end
@@ -1,9 +0,0 @@
1
- class CreatePrincipals < ActiveRecord::Migration
2
- def change
3
- create_table :principals do |t|
4
- t.string :protokoll_number
5
-
6
- t.timestamps
7
- end
8
- end
9
- end