Sha256: 1246dd26329b7efe9770d247432a263f010813a1b6fcff856e90fe843ad4cd27

Contents?: true

Size: 485 Bytes

Versions: 15

Compression:

Stored size: 485 Bytes

Contents

# frozen_string_literal: true

module Grumlin::Shortcuts::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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
grumlin-1.2.0 lib/grumlin/shortcuts/properties.rb
grumlin-1.1.0 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.4 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.3 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.3.beta1 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.2 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.1 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.0 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.0.rc7 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.0.rc6 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.0.rc5 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.0.rc4 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.0.rc3 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.0.rc2 lib/grumlin/shortcuts/properties.rb
grumlin-1.0.0.rc1 lib/grumlin/shortcuts/properties.rb