Class: NeoScout::Constraints::PropConstraint

Inherits:
Constraint
  • Object
show all
Defined in:
lib/neoscout/constraints.rb

Direct Known Subclasses

GDB_Neo4j::Constraints::PropConstraint

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Constraint

#satisfied_by?, #satisfied_by_edge?, #satisfied_by_node?

Constructor Details

#initialize(args = {}) ⇒ PropConstraint

Returns a new instance of PropConstraint.

Raises:

  • (ArgumentError)


15
16
17
18
19
20
21
22
23
# File 'lib/neoscout/constraints.rb', line 15

def initialize(args = {})
  super(args)
  @name  = args[:name]
  @opt   = args[:opt]
  @type  = args[:type]

  raise ArgumentError unless @name.kind_of? String
  raise ArgumentError unless @name.length > 0
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/neoscout/constraints.rb', line 13

def name
  @name
end

#optObject (readonly)

Returns the value of attribute opt.



13
14
15
# File 'lib/neoscout/constraints.rb', line 13

def opt
  @opt
end

#typeObject (readonly)

Returns the value of attribute type.



13
14
15
# File 'lib/neoscout/constraints.rb', line 13

def type
  @type
end

Instance Method Details

#to_sObject



25
26
27
28
29
30
# File 'lib/neoscout/constraints.rb', line 25

def to_s
  opt_s  = if @opt then " (opt.)" else '' end
  type_s = if @type then ": #{@type}" else '' end

  "#{@name}#{type_s}#{opt_s}"
end