backframe 0.0.20 → 0.0.21

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: b418621aa2b85b136a6676ea9c8fec98193536fb
4
- data.tar.gz: ee6a1978fc27ca1d68ec771ea4e4cdaf302f824d
3
+ metadata.gz: 3c0d24ab06f49de1e0896bfbb425d52178e8acfd
4
+ data.tar.gz: f52fdfa058db885a75eb55e98f374190a0b6407a
5
5
  SHA512:
6
- metadata.gz: ac9d3dc337d0990be7f309173e18df5cb7538cf3d538e26b7dd9b26070970751bc89310fd7cdc2256b82f82e4637ac6319fd8382c049d8eed647dcef43271aea
7
- data.tar.gz: 8a8ddce1a36ab3113132c415a53e8b6da69106aff7076bb0d13883e497369146212a28ae332e36de1ef2daf0bb549e142f93ad57f6660122f433cf7b5d5ca09e
6
+ metadata.gz: 540f5dd53eaed8e5d1281ba0bc7000061e2e7d31ba10d971c310198f57b9b905b66059d7a795d44d231461ab016b445688e27706c0cb9514a8d329e98cb936fa
7
+ data.tar.gz: 45fa7b20bb8deba3a1f8e9f8f5c86faf272fbd65cbcfaac94aab730c0b7e652634abcdad9eb14f804adb8cd917fa1ca7ea1674eb7a43284b5db388cf392d01a2
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
2
  require 'rspec/core/rake_task'
3
3
  require 'bundler/version'
4
4
  require './lib/backframe'
5
+ require './lib/backframe/version'
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec) do |t|
7
8
  t.rspec_opts = ['--color']
@@ -10,7 +10,7 @@ module Backframe
10
10
  class_methods do
11
11
  def acts_as_activation(model, *args)
12
12
 
13
- arguments = args[0]
13
+ arguments = args[0] || {}
14
14
 
15
15
  activation = arguments[:activation] || 'Backframe::Activation'
16
16
 
@@ -10,7 +10,7 @@ module Backframe
10
10
  class_methods do
11
11
  def acts_as_reset(model, *args)
12
12
 
13
- arguments = args[0]
13
+ arguments = args[0] || {}
14
14
 
15
15
  reset = arguments[:reset] || 'Backframe::Reset'
16
16
 
@@ -10,7 +10,7 @@ module Backframe
10
10
 
11
11
  class_methods do
12
12
  def acts_as_resource(resource, *args)
13
- arguments = (args.present?) ? args[0] : {}
13
+ arguments = args[0] || {}
14
14
 
15
15
  @resource = resource
16
16
  @resource_opts = arguments
@@ -10,7 +10,7 @@ module Backframe
10
10
  class_methods do
11
11
  def acts_as_session(model, *args)
12
12
 
13
- arguments = args[0]
13
+ arguments = args[0] || {}
14
14
 
15
15
  class_eval <<-EOV
16
16
 
@@ -11,7 +11,7 @@ module Backframe
11
11
  module ClassMethods
12
12
 
13
13
  def acts_as_user(*args)
14
- arguments = args[0]
14
+ arguments = args[0] || {}
15
15
 
16
16
  reset = arguments[:reset] || 'Backframe::Reset'
17
17
  activation = arguments[:activation] || 'Backframe::Activation'
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+
3
+ module Backframe
4
+ module DefaultValues
5
+ extend ActiveSupport::Concern
6
+
7
+ def self.included(base)
8
+ base.send :extend, ClassMethods
9
+ end
10
+
11
+ module ClassMethods
12
+
13
+ def default_values(*args)
14
+
15
+ arguments = args[0] || {}
16
+
17
+ after_initialize :set_default_values, :if => Proc.new { |o| o.new_record? }
18
+
19
+ class_eval <<-EOV
20
+
21
+ def set_default_values
22
+ self.attributes = #{arguments.symbolize_keys.to_s}
23
+ end
24
+
25
+ EOV
26
+
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -13,6 +13,7 @@ module Backframe
13
13
  ActiveRecord::Base.send(:include, Backframe::ActsAsEnum)
14
14
  ActiveRecord::Base.send(:include, Backframe::ActsAsOrderable)
15
15
  ActiveRecord::Base.send(:include, Backframe::ActsAsUser)
16
+ ActiveRecord::Base.send(:include, Backframe::DefaultValues)
16
17
  ActiveRecord::Base.send(:include, Backframe::FilterSort)
17
18
  ActiveRecord::Migration.send(:include, Backframe::Migration)
18
19
  Backframe::Mime.register_types
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Backframe
4
- VERSION = '0.0.20'
4
+ VERSION = '0.0.21'
5
5
  end
data/lib/backframe.rb CHANGED
@@ -15,6 +15,7 @@ require 'backframe/activerecord/acts_as_distinct'
15
15
  require 'backframe/activerecord/acts_as_orderable'
16
16
  require 'backframe/activerecord/acts_as_enum'
17
17
  require 'backframe/activerecord/acts_as_user'
18
+ require 'backframe/activerecord/default_values'
18
19
  require 'backframe/activerecord/filter_sort'
19
20
  require 'backframe/activerecord/migration'
20
21
  require 'backframe/models/activity'
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.20
4
+ version: 0.0.21
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-11 00:00:00.000000000 Z
12
+ date: 2016-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: write_xlsx
@@ -110,6 +110,7 @@ files:
110
110
  - lib/backframe/activerecord/acts_as_enum.rb
111
111
  - lib/backframe/activerecord/acts_as_orderable.rb
112
112
  - lib/backframe/activerecord/acts_as_user.rb
113
+ - lib/backframe/activerecord/default_values.rb
113
114
  - lib/backframe/activerecord/filter_sort.rb
114
115
  - lib/backframe/activerecord/migration.rb
115
116
  - lib/backframe/mime.rb