pig-media-server 100 → 200

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1450f2afe845735323e207d6ca9c4aee910c8e86
4
- data.tar.gz: 742fd37ce519d014b1cedd7d0b6a23a80fc43c21
3
+ metadata.gz: 3e768e9c0ca509bbfe0436b914d3a9d701e3f011
4
+ data.tar.gz: 4029590cdbeab4e540acf47505c52468d2720a64
5
5
  SHA512:
6
- metadata.gz: e722dfe919ff6bbcc51c6b6ca5f4b428e92a4ccf000ed6c052a57772eebcacba43df284c20c26f5e0374b9be3130b9fe9d65531d5b2757cf1c1d81f4c27a08aa
7
- data.tar.gz: 75f4766423d66479199963b34d50e15ff3ed9757636c24b93da160c3dec49c6dbe65943d1860a619d0579df69b8af00547e24eb58d2126b3ac0764eb2c9a21e2
6
+ metadata.gz: 0b5c47f8cd29bfaa8e9a29e2e0da7826ad3228fbc627edb01ca55590b7ab745ebbac8b4ba15eca4f5215e65d0584ad6658f71cfaebe3a1e898e73e9a4f794224
7
+ data.tar.gz: f17ba70242e1bb0f55afc98d4c9b8d4f071076a8cb12c44125354e375ea2d921ac076f6a57e9f745f39f925e98b3a1c686351aa1307312904f307358f5d2b930
@@ -10,8 +10,8 @@ ActiveRecord::Base.logger = Logger.new(STDOUT)
10
10
 
11
11
  tables = ActiveRecord::Base.connection.tables
12
12
 
13
- unless tables.index('app_datas')
14
- ActiveRecord::Migration.create_table :app_datas do |t|
13
+ unless tables.index('app_data')
14
+ ActiveRecord::Migration.create_table :app_data do |t|
15
15
  t.string :key
16
16
  t.string :original_key
17
17
  t.text :value
@@ -35,29 +35,7 @@ unless tables.index('recents')
35
35
  end
36
36
  end
37
37
 
38
- class AppData < ActiveRecord::Base
39
- def self.find key
40
- key = Digest::MD5.hexdigest(key)
41
- a = self.where(key: key).first
42
- if a
43
- a.parse
44
- else
45
- nil
46
- end
47
- end
48
-
49
- def self.set key, value
50
- a_key = Digest::MD5.hexdigest(key)
51
- a = self.find_or_create_by(key: a_key)
52
- a.value = value.to_json
53
- a.original_key = key
54
- a.save!
55
- end
56
-
57
- def self.all
58
- super.map{|x| {key: x.original_key, value: x.parse}}
59
- end
60
-
38
+ class AppDatum < ActiveRecord::Base
61
39
  def parse
62
40
  val = self.value
63
41
  case val
@@ -78,6 +56,30 @@ class AppData < ActiveRecord::Base
78
56
  end
79
57
  end
80
58
 
59
+ class AppData
60
+ def self.find key
61
+ key = Digest::MD5.hexdigest(key)
62
+ a = AppDatum.where(key: key).first
63
+ if a
64
+ a.parse
65
+ else
66
+ nil
67
+ end
68
+ end
69
+
70
+ def self.set key, value
71
+ a_key = Digest::MD5.hexdigest(key)
72
+ a = AppDatum.find_or_create_by(key: a_key)
73
+ a.value = value.to_json
74
+ a.original_key = key
75
+ a.save!
76
+ end
77
+
78
+ def self.all
79
+ AppDatum.all.map{|x| {key: x.original_key, value: x.parse}}
80
+ end
81
+ end
82
+
81
83
  class Star < ActiveRecord::Base
82
84
  end
83
85
 
@@ -1,3 +1,3 @@
1
1
  module PigMediaServer
2
- VERSION = "100"
2
+ VERSION = "200"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pig-media-server
3
3
  version: !ruby/object:Gem::Version
4
- version: '100'
4
+ version: '200'
5
5
  platform: ruby
6
6
  authors:
7
7
  - ssig33