README.md in measured-2.0.0.pre3 vs README.md in measured-2.0.0.pre4
- old
+ new
@@ -54,10 +54,24 @@
rescue Measured::UnitError
puts "Unknown unit"
end
```
+Parse from string without having to split out the value and unit first:
+
+```ruby
+Measured::Weight.parse("123 grams")
+> #<Measured::Weight 123 g>
+```
+
+Parse can scrub extra whitespace and split number from unit:
+
+```ruby
+Measured::Weight.parse(" 2kg ")
+> #<Measured::Weight 2 kg>
+```
+
Perform addition / subtraction against other units, all represented internally as `Rational` or `BigDecimal`:
```ruby
Measured::Weight.new(1, :g) + Measured::Weight.new(2, :g)
> #<Measured::Weight 3 g>
@@ -167,18 +181,10 @@
aliases: [:au], # All units allow aliases, as long as they are unique
value: ["1.5 bu"] # The conversion rate to another unit
end
```
-By default all names and aliases are case insensitive. If you would like to create a new unit with names and aliases that are case sensitive, specify the case sensitive flag when building your unit:
-
-```ruby
-Measured::Thing = Measured.build(case_sensitive: true) do
- unit :base_unit, aliases: [:bu]
-end
-```
-
-Other than case sensitivity, both classes are identical to each other. The `case_sensitive` flag, which is false by default, gets taken into account any time you attempt to reference a unit by name or alias.
+All unit names are case sensitive.
Values for conversion units can be defined as a string with two tokens `"number unit"` or as an array with two elements. All values will be parsed as / coerced to `Rational`. Conversion paths don't have to be direct as a conversion table will be built for all possible conversions.
### Namespaces