Sha256: f7a4df2e9472b145f596dd402930b8a88176409871c4229c163ad20b460fb610

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

module PrettyFeed
  # Pretty Feed Truthy Falsey
  #
  # Usage in a rake task, for example:
  #
  #   namespace :scrub do
  #     task :blurb => :environment do |_t, args|
  #       include PrettyFeed::PfTf.new(truthy: 'green', falsey: 'blue')
  #       pf("this will be green", true)
  #       # => "this will be green" # but in green
  #       pf("this will be blue", false)
  #       # => "this will be blue" # but in blue
  #     end
  #   end
  #
  class PfTf < Module
    def initialize(truthy: "green", falsey: "red")
      # Ruby's Module initializer doesn't take any arguments
      super()
      @truthy = truthy
      @falsey = falsey
    end

    def included(base)
      modulizer = Modulizer.to_mod(truthy: @truthy, falsey: @falsey)
      base.send(:prepend, modulizer)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pretty_feed-0.1.0 lib/pretty_feed/pf_tf.rb