README.md in usps_flags-0.2.3 vs README.md in usps_flags-0.2.4
- old
+ new
@@ -19,11 +19,13 @@
```
Create the file `config/initializers/usps_flags.rb`:
```ruby
-USPSFlags::Config.flags_dir "#{Rails.root}/app/assets/images/flags"
+USPSFlags::Config.new do |config|
+ config.flags_dir "#{Rails.root}/app/assets/images/flags"
+end
```
### Other
Run the following commands:
@@ -117,20 +119,20 @@
## Constructing
You can also construct individual flags using the following syntax:
```ruby
-f = USPSFlags.new do
- type "LtC"
- scale 3
- field false
- trim true
- svg_file "/path/to/svg/output.svg"
- png_file "/path/to/png/output.png"
+flag = USPSFlags.new do |f|
+ f.type = "LtC"
+ f.scale = 3
+ f.field = false
+ f.trim = true
+ f.svg_file = "/path/to/svg/output.svg"
+ f.png_file = "/path/to/png/output.png"
end
-f.svg # Generate SVG file
-f.png # Generate PNG file
+flag.svg #=> Generates SVG file at "/path/to/svg/output.svg"
+flag.png #=> Generates PNG file at "/path/to/png/output.png"
```
- Calling any DSL method without argument, or with `nil` as argument will return
the current value.
- You can explicitly set `svg_file` to `""` to suppress printing the SVG content