# File lib/ice_cube/rule.rb, line 64
      def from_hash(original_hash)
        hash = IceCube::FlexibleHash.new original_hash

        unless hash[:rule_type] && match = hash[:rule_type].match(/\:\:(.+?)Rule/)
          raise ArgumentError, 'Invalid rule type'
        end

        interval_type = match[1].downcase.to_sym

        unless INTERVAL_TYPES.include?(interval_type)
          raise ArgumentError, "Invalid rule frequency type: #{match[1]}"
        end

        rule = IceCube::Rule.send(interval_type, hash[:interval] || 1)

        if match[1] == "Weekly"
          rule.interval(hash[:interval] || 1, TimeUtil.wday_to_sym(hash[:week_start] || 0))
        end

        rule.until(TimeUtil.deserialize_time(hash[:until])) if hash[:until]
        rule.count(hash[:count]) if hash[:count]

        hash[:validations] && hash[:validations].each do |name, args|
          apply_validation(rule, name, args)
        end

        rule
      end