Sha256: 7983285de7c5a8326653dc7dc63a518c7bed5dc56512907db0af344e55b77ab2

Contents?: true

Size: 569 Bytes

Versions: 9

Compression:

Stored size: 569 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  module Shortcuts
    module Properties
      extend Grumlin::Shortcuts

      shortcut :props do |cardinality = nil, **props|
        props.reduce(self) do |tt, (prop, value)|
          next tt if value.nil? # nils are not supported
          next tt.property(prop, value) if cardinality.nil?

          tt.property(cardinality, prop, value)
        end
      end

      shortcut :hasAll do |**props|
        props.reduce(self) do |tt, (prop, value)|
          tt.has(prop, value)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
grumlin-0.23.0 lib/grumlin/shortcuts/properties.rb
grumlin-0.22.5 lib/grumlin/shortcuts/properties.rb
grumlin-0.22.4 lib/grumlin/shortcuts/properties.rb
grumlin-0.22.3 lib/grumlin/shortcuts/properties.rb
grumlin-0.22.2 lib/grumlin/shortcuts/properties.rb
grumlin-0.22.1 lib/grumlin/shortcuts/properties.rb
grumlin-0.22.0 lib/grumlin/shortcuts/properties.rb
grumlin-0.21.1 lib/grumlin/shortcuts/properties.rb
grumlin-0.21.0 lib/grumlin/shortcuts/properties.rb