Class: WorthSaving::Info
- Inherits:
-
Object
- Object
- WorthSaving::Info
- Defined in:
- lib/worth_saving/info.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(klass, opts) ⇒ Info
constructor
A new instance of Info.
- #saves_field?(field) ⇒ Boolean
Constructor Details
#initialize(klass, opts) ⇒ Info
Returns a new instance of Info.
5 6 7 8 |
# File 'lib/worth_saving/info.rb', line 5 def initialize(klass, opts) register_class klass opts end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
3 4 5 |
# File 'lib/worth_saving/info.rb', line 3 def scope @scope end |
Class Method Details
.attribute_whitelisting_required? ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/worth_saving/info.rb', line 14 def self.attribute_whitelisting_required? puts "Rails version: #{Rails.version}" puts "Defined?(ProtectedAttributes): #{defined?(ProtectedAttributes) == 'constant'}" result = Rails.version.match(/^3/).present? || defined?(ProtectedAttributes) == 'constant' puts "Returning: #{result}" result end |
.class_with_name(name) ⇒ Object
10 11 12 |
# File 'lib/worth_saving/info.rb', line 10 def self.class_with_name(name) classes.find{ |klass| klass.name == name.camelcase } end |
Instance Method Details
#saves_field?(field) ⇒ Boolean
22 23 24 |
# File 'lib/worth_saving/info.rb', line 22 def saves_field?(field) !@excluded_fields.include? field end |