README.md in u-attributes-1.0.1 vs README.md in u-attributes-1.1.0
- old
+ new
@@ -324,19 +324,19 @@
## Built-in extensions
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: If you desire require only one feature, use the `Micro::Attributes.feature()` method.
+But, if you desire...
+1. only one feature, use the `Micro::Attributes.feature()` method.
+2. except one or more features, use the `Micro::Attributes.without()` method.
```ruby
-#----------------------------------#
-# Via Micro::Attributes.features() #
-#----------------------------------#
+#===========================#
+# Loading specific features #
+#===========================#
-# Loading specific features
-
class Job
include Micro::Attributes.feature(:diff)
attribute :id
attribute :state, 'sleeping'
@@ -344,12 +344,14 @@
def initialize(options)
self.attributes = options
end
end
-# Loading all features
-# ---
+#======================#
+# Loading all features #
+# --- #
+#======================#
class Job
include Micro::Attributes.features
attributes :id, state: 'sleeping'
@@ -393,9 +395,23 @@
class Job
include Micro::Attributes.to_initialize!(diff: false, activemodel_validations: true)
# Same of `include Micro::Attributes.with(:strict_initialize, :activemodel_validations)`
end
+
+#=====================================#
+# Loading except one or more features #
+# ----- #
+#=====================================#
+
+class Job
+ include Micro::Attributes.without(:diff)
+
+ attributes :id, state: 'sleeping'
+end
+
+# Note:
+# The method `Micro::Attributes.without()` returns `Micro::Attributes` if all features extensions were used.
```
### ActiveModel::Validations extension
If your application uses ActiveModel as a dependency (like a regular Rails app). You will be enabled to use the `actimodel_validations` extension.