Sha256: 6c0a0edc797bb2df1cf9fdc258c8698a5b176270125e4a5a11574cddfc0e6f13

Contents?: true

Size: 567 Bytes

Versions: 8

Compression:

Stored size: 567 Bytes

Contents

require 'sanitize'

module Html2rss
  module AttributePostProcessors
    class Template
      def initialize(value, options, item)
        @value = value
        @options = options
        @item = item
      end

      def get
        string % methods
      end

      private

      def string
        @options['string']
      end

      def methods
        @methods ||= @options['methods'].map { |method|
          if method == 'self'
            @value
          else
            @item.send(method.to_sym)&.to_s
          end
        }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
html2rss-0.3.3 lib/html2rss/attribute_post_processors/template.rb
html2rss-0.3.2 lib/html2rss/attribute_post_processors/template.rb
html2rss-0.3.1 lib/html2rss/attribute_post_processors/template.rb
html2rss-0.3.0 lib/html2rss/attribute_post_processors/template.rb
html2rss-0.2.2 lib/html2rss/attribute_post_processors/template.rb
html2rss-0.2.1 lib/html2rss/attribute_post_processors/template.rb
html2rss-0.2.0 lib/html2rss/attribute_post_processors/template.rb
html2rss-0.1.0 lib/html2rss/attribute_post_processors/template.rb