README.md in u-attributes-0.11.0 vs README.md in u-attributes-0.12.0

- old
+ new

@@ -264,20 +264,21 @@ p Person.new(name: 'John').attributes # {"age"=>nil, "name"=>"John"} ``` ## Built-in extensions -You can use the method `Micro::Attributes.features()` to combine and require only the features that better fit your needs. +You can use the method `Micro::Attributes.features()` or `Micro::Attributes.with()` to combine and require only the features that better fit your needs. -Note: The method `Micro::Attributes.with()` is an alias for `Micro::Attributes.features()`. - ### Usage ```ruby #----------------------------------# # Via Micro::Attributes.features() # #----------------------------------# + +# Loading specific features + class Job include Micro::Attributes.features(:diff) attribute :id attribute :state, 'sleeping' @@ -285,17 +286,36 @@ def initialize(options) self.attributes = options end end +# Loading all features +# --- + +class Job + include Micro::Attributes.features + + attributes :id, state: 'sleeping' +end + +# Note: +# If `Micro::Attributes.features()` be invoked without arguments, a module with all features will be returned. + # --------------------------------------------------------------------# # Using the .with() method alias and adding the initialize extension. # # --------------------------------------------------------------------# class Job include Micro::Attributes.with(:initialize, :diff) attributes :id, state: 'sleeping' end + +# Note: +# The method `Micro::Attributes.with()` will raise an exception if no arguments/features were declared. +# +# class Job +# include Micro::Attributes.with() # ArgumentError (Invalid feature name! Available options: diff, initialize, activemodel_validations) +# end #---------------------------------------# # Via Micro::Attributes.to_initialize() # #---------------------------------------# class Job