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.
69 70 71 72 |
# File 'lib/paper_trail/human/configuration.rb', line 69 def initialize @fields = {} @item_name_attribute = nil end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
67 68 69 |
# File 'lib/paper_trail/human/configuration.rb', line 67 def fields @fields end |
#item_name_attribute ⇒ Object (readonly)
Returns the value of attribute item_name_attribute.
67 68 69 |
# File 'lib/paper_trail/human/configuration.rb', line 67 def item_name_attribute @item_name_attribute end |
Instance Method Details
#field(name, type, **options) ⇒ Object
74 75 76 |
# File 'lib/paper_trail/human/configuration.rb', line 74 def field(name, type, **) @fields[name.to_s] = { type: type, options: } end |
#freeze ⇒ Object
82 83 84 85 |
# File 'lib/paper_trail/human/configuration.rb', line 82 def freeze @fields.freeze super end |
#item_name(attribute_or_lambda) ⇒ Object
78 79 80 |
# File 'lib/paper_trail/human/configuration.rb', line 78 def item_name(attribute_or_lambda) @item_name_attribute = attribute_or_lambda end |