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