Module: KeyValueName::Name::InstanceMethods

Included in:
FileName::InstanceMethods, FolderName::InstanceMethods
Defined in:
lib/key_value_name/mixins/name.rb

Overview

Instance method mixin for a KeyValueName.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



11
12
13
# File 'lib/key_value_name/mixins/name.rb', line 11

def parent
  @parent
end

Instance Method Details

#<=>(other) ⇒ Object



22
23
24
# File 'lib/key_value_name/mixins/name.rb', line 22

def <=>(other)
  self.class.key_value_name_spec.compare(self, other)
end

#to_sObject



13
14
15
16
17
18
19
20
# File 'lib/key_value_name/mixins/name.rb', line 13

def to_s
  result = self.class.key_value_name_spec.generate(self)
  if parent
    File.join(parent.to_s, result)
  else
    result
  end
end