From 2086bfffc16455dfb5caea373d3f44909b1ab853 Mon Sep 17 00:00:00 2001 From: "Billy.Zheng" Date: Thu, 20 Jul 2017 02:43:22 +0800 Subject: [PATCH] Add state new usage for following example. Personal think following more intuitive for a declare statement like syntax. e.g. state :state_name, 'initial value' state :state_name, 'initial value', class: true --- lib/hyper-store/state_wrapper/argument_validator.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/hyper-store/state_wrapper/argument_validator.rb b/lib/hyper-store/state_wrapper/argument_validator.rb index 84492bb..91a58c4 100644 --- a/lib/hyper-store/state_wrapper/argument_validator.rb +++ b/lib/hyper-store/state_wrapper/argument_validator.rb @@ -35,8 +35,11 @@ def parse_arguments(*args) end name, initial_value = args[0].shift - # Otherwise just the name is passed in by itself first + elsif args.count == 3 + # name, initial value is passed in by first and second + name, initial_value = args.shift(2) else + # Otherwise just the name is passed in by itself first name = args.shift end