Sha256: 6f6f35f3b2104471d76bfac614e3a33cb2cb36d693224035455a6ee56a5eb35d

Contents?: true

Size: 903 Bytes

Versions: 18

Compression:

Stored size: 903 Bytes

Contents

class ExtensionHelper < SimpleDelegator
  attr_reader :params, :builder
  def initialize(extension, params, builder, defaults = {})
    # TODO: We should allow for default values to be passed in here
    # That will allow for defaults to be pulled out of the extension and it
    # will also let better enable overriding of those values that do not have
    # an option to do so currently.
    @params = if params.is_a? Hash
                defaults.merge params
              else
                params
              end
    @builder = builder
    @extension = extension

    @extension.parameters.try(:each) do |method_name|
      define_singleton_method(method_name) { self[method_name] }
    end

    super @params
  end

  # TODO: Method missing that pulls out of params?
  # That would allow everything to just call helper.foo
  # and then the helper can do any fiddling it needs to (or not)
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
jenkins_pipeline_builder-1.10.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.9.1 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.9.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.8.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.7.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.5.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.3.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.2.1 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.2.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.1.5 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.1.4 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.1.3 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.1.2 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.1.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-1.0.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-0.16.3 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-0.16.2 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb
jenkins_pipeline_builder-0.16.0 lib/jenkins_pipeline_builder/extensions/helpers/extension_helper.rb