Class: PaperTrail::Human::ModelConfig
- Inherits:
-
Object
- Object
- PaperTrail::Human::ModelConfig
- Defined in:
- lib/paper_trail/human/configuration.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#item_name_attribute ⇒ Object
readonly
Returns the value of attribute item_name_attribute.
Instance Method Summary collapse
- #field(name, type, **options) ⇒ Object
- #freeze ⇒ Object
-
#initialize ⇒ ModelConfig
constructor
A new instance of ModelConfig.
- #item_name(attribute_or_lambda) ⇒ Object
Constructor Details
#initialize ⇒ ModelConfig
Returns a new instance of ModelConfig.
79 80 81 82 |
# File 'lib/paper_trail/human/configuration.rb', line 79 def initialize @fields = {} @item_name_attribute = nil end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
77 78 79 |
# File 'lib/paper_trail/human/configuration.rb', line 77 def fields @fields end |
#item_name_attribute ⇒ Object (readonly)
Returns the value of attribute item_name_attribute.
77 78 79 |
# File 'lib/paper_trail/human/configuration.rb', line 77 def item_name_attribute @item_name_attribute end |
Instance Method Details
#field(name, type, **options) ⇒ Object
84 85 86 |
# File 'lib/paper_trail/human/configuration.rb', line 84 def field(name, type, **) @fields[name.to_s] = { type: type, options: } end |
#freeze ⇒ Object
92 93 94 95 |
# File 'lib/paper_trail/human/configuration.rb', line 92 def freeze @fields.freeze super end |
#item_name(attribute_or_lambda) ⇒ Object
88 89 90 |
# File 'lib/paper_trail/human/configuration.rb', line 88 def item_name(attribute_or_lambda) @item_name_attribute = attribute_or_lambda end |