Sha256: eda75fa25da1d5b96fda5b4a518ea1a0fc9ce38cd28b9648bcf6b9e6b03c33bd

Contents?: true

Size: 840 Bytes

Versions: 39

Compression:

Stored size: 840 Bytes

Contents

module Picky

  module Wrappers

    module Bundle

      # A calculation rewrites the symbol into a float.
      #
      # Note: A calculation will try to find a float in the index,
      #       not a sym.
      #
      class Calculation < Wrapper

        # API.
        #
        # By default, a calculation does not
        # calculate anything.
        #
        def calculate float
          float
        end

        # TODO Symbols. Use a block here?
        #
        # THINK Move the calculation elsewhere?
        #
        def ids float_str
          @bundle.ids calculate(float_str.to_f).to_s
        end

        # TODO Symbols.
        #
        # THINK Move the calculation elsewhere?
        #
        def weight float_str
          @bundle.weight calculate(float_str.to_f).to_s
        end

      end

    end

  end

end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
picky-4.2.4 lib/picky/wrappers/bundle/calculation.rb
picky-4.2.3 lib/picky/wrappers/bundle/calculation.rb
picky-4.2.2 lib/picky/wrappers/bundle/calculation.rb
picky-4.2.1 lib/picky/wrappers/bundle/calculation.rb
picky-4.2.0 lib/picky/wrappers/bundle/calculation.rb
picky-4.1.0 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.9 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.8 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.7 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.6 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.5 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.4 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.3 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.1 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.0 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.0pre6 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.0pre5 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.0pre3 lib/picky/wrappers/bundle/calculation.rb
picky-4.0.0pre2 lib/picky/wrappers/bundle/calculation.rb