Sha256: 5035d9c1f8760d3c4a0fb0175dd321c782209abacaee025abc2a4adb803f36bf

Contents?: true

Size: 616 Bytes

Versions: 8

Compression:

Stored size: 616 Bytes

Contents

module Saml
  module Kit
    module Buildable
      extend ActiveSupport::Concern

      class_methods do
        def build(*args) # :yields builder
          builder(*args) do |builder|
            yield builder if block_given?
          end.build
        end

        def build_xml(*args) # :yields builder
          builder(*args) do |builder|
            yield builder if block_given?
          end.to_xml
        end

        def builder(*args) # :yields builder
          builder_class.new(*args).tap do |builder|
            yield builder if block_given?
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
saml-kit-1.0.6 lib/saml/kit/buildable.rb
saml-kit-1.0.5 lib/saml/kit/buildable.rb
saml-kit-1.0.4 lib/saml/kit/buildable.rb
saml-kit-1.0.3 lib/saml/kit/buildable.rb
saml-kit-1.0.2 lib/saml/kit/buildable.rb
saml-kit-1.0.1 lib/saml/kit/buildable.rb
saml-kit-1.0.0 lib/saml/kit/buildable.rb
saml-kit-0.3.6 lib/saml/kit/buildable.rb