265bb3ef Stephen Paul Weber
1 year, 6 months ago
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# frozen_string_literal: true require "blather" module ToForm refine ::Hash do def to_fields map { |k, v| { var: k.to_s, value: v.to_s } } end def to_form(type) Blather::Stanza::Iq::X.new(type).tap do |form| form.fields = to_fields end end end end