Skip to content

Commit

Permalink
fixed readme and added clear instance method
Browse files Browse the repository at this point in the history
  • Loading branch information
hex0cter committed May 20, 2016
1 parent 7f20ce5 commit 299577a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In your ruby code,

```ruby
require 'yaml/sugar'
Yaml.load(dir)
YamlSugar.load(dir)
```

then you are ready to go.
Expand Down
2 changes: 2 additions & 0 deletions lib/yaml/sugar_impl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def method_missing(method_sym, *args)
@config.send method_sym, *args
elsif method_sym.to_s.end_with?('=')
@config.send method_sym, *args
elsif method_sym == :clear
@config = OpenStruct.new
else
nil
end
Expand Down
3 changes: 3 additions & 0 deletions test/test_yaml_sugar_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def test_dynamic_attr

yaml_sugar.set(:attr, :bar)
assert yaml_sugar.attr == :bar

yaml_sugar.clear
assert yaml_sugar.attr.nil?
end

def test_overwriting
Expand Down

0 comments on commit 299577a

Please sign in to comment.