backframe 0.0.10 → 0.0.11

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: 3de06cb531fbad921e5fafac1a04b01512061675
4
- data.tar.gz: 362c046128e883f70b9c523e58ec771bc22814d0
3
+ metadata.gz: b2d283b50d4b95937c4c1a2ca673320a31f3843d
4
+ data.tar.gz: ab94b8b985cf0602d113a9a735746a69359f8317
5
5
  SHA512:
6
- metadata.gz: 2f22db57f526565517c16f8508db58f2cb647a85f0ea231c4d0796a544027d8d4fcba2f1e32749e87a56a7618b1999636edd58da65adbac83bc8d0ebf5a04bca
7
- data.tar.gz: 0e4a21a30dd1e73875a29e1c09d3d03f57e7a3bbabe3c98a6b9a0e756722d98c2ed0d8a582907282e56279b94058ea8436e1fc6857738963697cd1490971c24c
6
+ metadata.gz: dcb2eac1aec02e8ef1eca1790f0205750b90185fd4c259be010eae5df820cd526343b9352208957b51301b47d3a80605c604bc624360287143db438c60498d59
7
+ data.tar.gz: 2b4ed0218a627b7ddf24cc3448c7b521336aee15f3bd57c3f44d7a10d5be8674ca61673ac90301fb56ab3416e5f97daa487daac882095c4efe5da9c3dff14898
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Backframe
4
- module ActsAsStatus
4
+ module ActsAsEnum
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  def self.included(base)
@@ -10,7 +10,7 @@ module Backframe
10
10
 
11
11
  module ClassMethods
12
12
 
13
- def acts_as_status(*args)
13
+ def acts_as_enum(*args)
14
14
 
15
15
  field = args[0]
16
16
  arguments = args[1]
@@ -24,10 +24,10 @@ module Backframe
24
24
 
25
25
  if arguments.key?(:default)
26
26
 
27
- after_initialize "init_#{field}_status".to_sym, :if => Proc.new { |d| d.new_record? }
27
+ after_initialize "init_#{field}".to_sym, :if => Proc.new { |d| d.new_record? }
28
28
 
29
29
  class_eval <<-EOV
30
- def init_#{field}_status
30
+ def init_#{field}
31
31
  self.#{field} ||= '#{arguments[:default]}'
32
32
  end
33
33
  EOV
@@ -38,13 +38,14 @@ module Backframe
38
38
 
39
39
  validates_inclusion_of field, :in => arguments[:in]
40
40
 
41
- arguments[:in].each do |status|
41
+ arguments[:in].each do |option|
42
42
  class_eval <<-EOV
43
- scope :#{status}, -> { where(:status => '#{status}') }
43
+ scope :#{field}_#{option}, -> { where(:#{field} => '#{option}') }
44
44
 
45
- def #{status}?
46
- self.#{field} == '#{status}'
45
+ def #{field}_#{option}?
46
+ self.#{field} == '#{option}'
47
47
  end
48
+
48
49
  EOV
49
50
  end
50
51
 
@@ -10,8 +10,8 @@ module Backframe
10
10
  ActionController::Base.send(:include, Backframe::ActsAsSession)
11
11
  ActiveRecord::Base.send(:include, Backframe::ActsAsActivable)
12
12
  ActiveRecord::Base.send(:include, Backframe::ActsAsDistinct)
13
+ ActiveRecord::Base.send(:include, Backframe::ActsAsEnum)
13
14
  ActiveRecord::Base.send(:include, Backframe::ActsAsOrderable)
14
- ActiveRecord::Base.send(:include, Backframe::ActsAsStatus)
15
15
  ActiveRecord::Base.send(:include, Backframe::ActsAsUser)
16
16
  ActiveRecord::Base.send(:include, Backframe::FilterSort)
17
17
  ActiveRecord::Migration.send(:include, Backframe::Migration)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Backframe
4
- VERSION = '0.0.10'
4
+ VERSION = '0.0.11'
5
5
  end
data/lib/backframe.rb CHANGED
@@ -13,7 +13,7 @@ require 'backframe/actioncontroller/acts_as_session'
13
13
  require 'backframe/activerecord/acts_as_activable'
14
14
  require 'backframe/activerecord/acts_as_distinct'
15
15
  require 'backframe/activerecord/acts_as_orderable'
16
- require 'backframe/activerecord/acts_as_status'
16
+ require 'backframe/activerecord/acts_as_enum'
17
17
  require 'backframe/activerecord/acts_as_user'
18
18
  require 'backframe/activerecord/filter_sort'
19
19
  require 'backframe/activerecord/migration'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backframe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Kops
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-10 00:00:00.000000000 Z
12
+ date: 2016-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: write_xlsx
@@ -107,8 +107,8 @@ files:
107
107
  - lib/backframe/actioncontroller/acts_as_session.rb
108
108
  - lib/backframe/activerecord/acts_as_activable.rb
109
109
  - lib/backframe/activerecord/acts_as_distinct.rb
110
+ - lib/backframe/activerecord/acts_as_enum.rb
110
111
  - lib/backframe/activerecord/acts_as_orderable.rb
111
- - lib/backframe/activerecord/acts_as_status.rb
112
112
  - lib/backframe/activerecord/acts_as_user.rb
113
113
  - lib/backframe/activerecord/filter_sort.rb
114
114
  - lib/backframe/activerecord/migration.rb