module KindHelper
KindHelper
. @module_description
Kind predicates and getters.
Public Instance Methods
base()
click to toggle source
base(). @description
Predicate. Verifies the kind is 'base'. A 'base' Node is a Node bearing no backward attachment and a forward attachment.
@return [TrueClass, FalseClass]
True in the case 'back' is nil and 'front' refers a Node. False otherwise.
# File lib/helpers/kind_helper.rb, line 55 def base() return (!back_attached() && front_attached()) end
common()
click to toggle source
common(). @description
Predicate. Verifies the kind is common. A 'common' Node is a fully attached Node.
@return [TrueClass, FalseClass]
True in the case both 'back' and 'front' refer Nodes.
# File lib/helpers/kind_helper.rb, line 45 def common() return (back_attached() && front_attached()) end
kind()
click to toggle source
kind(). @description
Discerns the kind. The kind is either 'base', 'common', 'lone', or 'pioneer'.
@return [String]
A kind String.
# File lib/helpers/kind_helper.rb, line 15 def kind() case when lone() return 'lone'.freeze() when common() return 'common'.freeze() when base() return 'base'.freeze() when pioneer() return 'pioneer'.freeze() end end
lone()
click to toggle source
lone(). @description
Predicate. Verifies the kind is lone. A 'lone' Node is a Node bearing no attachments.
@return [TrueClass, FalseClass]
True in the case self's 'back' reference and self's 'front' reference are nil. False otherwise.
# File lib/helpers/kind_helper.rb, line 35 def lone() return no_attachments() end
pioneer()
click to toggle source
pioneer(). @description
Predicate. Verifies self's kind is 'pioneer'. A 'pioneer' Node is a Node bearing a 'back' attachment and no 'front' attachment.
@return [TrueClass, FalseClass]
True in the case self's 'back' reference is a Node and self's 'front' reference is nil. False otherwise.
# File lib/helpers/kind_helper.rb, line 66 def pioneer() return (back_attached() && !front_attached()) end