Sha256: b5f2ceeef0646143d0bde6db9e755f93ea98690f4eea9eb64462c11267d41b48

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

module Conquer
  module Dzen
    module Positioning
      def ignore_bg(state = :on)
        if block_given?
          "^ib(1)#{yield}^ib(0)"
        else
          "^ib(#{state == :on ? 0 : 1})"
        end
      end

      def lock_x(options = {})
        if block_given?
          "#{'^ib(1)' if options[:ignore_bg]}" \
          "#{lock_x}#{yield}#{unlock_x}" \
          "#{'^ib(0)' if options[:ignore_bg]}"
        else
          "#{'^ib(1)' if options[:ignore_bg]}^p(_LOCK_X)"
        end
      end

      def unlock_x
        '^p(_UNLOCK_X)'
      end

      def shift(x, y = 0)
        return "#{shift(x, y)}#{yield}#{shift(-x)}^p()" if block_given?
        x = x.round
        y = y.round
        x = nil if x == 0
        y = nil if y == 0
        return unless x || y
        "^p(#{x};#{y})"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
conquer-dzen-0.1.3 lib/conquer/dzen/positioning.rb
conquer-dzen-0.1.2 lib/conquer/dzen/positioning.rb
conquer-dzen-0.1.1 lib/conquer/dzen/positioning.rb