Module: Clusta::Serialization::ClassMethods

Defined in:
lib/clusta/serialization.rb

Instance Method Summary collapse

Instance Method Details

#abbreviate(string) ⇒ Object



32
33
34
35
# File 'lib/clusta/serialization.rb', line 32

def abbreviate string
  Geometry.register_element self, string
  @abbreviation = string
end

#abbreviationObject



37
38
39
# File 'lib/clusta/serialization.rb', line 37

def abbreviation
  @abbreviation
end

#all_stream_namesObject



41
42
43
44
45
46
47
# File 'lib/clusta/serialization.rb', line 41

def all_stream_names
  [stream_name].tap do |names|
    names << abbreviation if abbreviation
    names << to_s
    names << to_s.split('::').last if respond_to?(:name) && name
  end
end

#set_stream_name(string) ⇒ Object



27
28
29
30
# File 'lib/clusta/serialization.rb', line 27

def set_stream_name string
  Geometry.register_element self, string
  @stream_name = string
end

#stream_nameObject



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/clusta/serialization.rb', line 49

def stream_name
  return @stream_name if @stream_name
  case
  when defined?(Settings) && Settings[:class_names].to_s == 'short' && abbreviation
    @stream_name = abbreviation
  when defined?(Settings) && Settings[:class_names].to_s == 'long'
    @stream_name = to_s
  else
    @stream_name = to_s.split("::").last
  end
end