Module: IceT::Conversions::Rule::ClassMethods
- Defined in:
- lib/ice_t/conversions.rb
Instance Method Summary collapse
Instance Method Details
#from_hash(hash) ⇒ Object
54 55 56 57 58 |
# File 'lib/ice_t/conversions.rb', line 54 def from_hash(hash) rule_class = hash[:rule] interval = hash[:interval].to_i eval(rule_class + ".new(#{interval})") end |
#from_json(json_string) ⇒ Object
50 51 52 53 |
# File 'lib/ice_t/conversions.rb', line 50 def from_json(json_string) hash = ActiveSupport::JSON.decode(json_string).symbolize_keys self.from_hash(hash) end |
#from_yaml(yaml_string) ⇒ Object
47 48 49 |
# File 'lib/ice_t/conversions.rb', line 47 def from_yaml(yaml_string) YAML::load(yaml_string) end |