Class: SIPP::SIPPCodeWrapper

Inherits:
Object
  • Object
show all
Includes:
Localiser
Defined in:
lib/sipp.rb

Instance Method Summary collapse

Methods included from Localiser

#translate

Constructor Details

#initialize(symbol) ⇒ SIPPCodeWrapper

Returns a new instance of SIPPCodeWrapper.



15
16
17
# File 'lib/sipp.rb', line 15

def initialize(symbol)
  @sym = symbol
end

Instance Method Details

#as_jsonObject



35
36
37
# File 'lib/sipp.rb', line 35

def as_json
  { klass_name.to_sym => @sym }
end

#klass_nameObject



23
24
25
26
27
28
29
# File 'lib/sipp.rb', line 23

def klass_name
  self.class.name.split('::').last
      .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
      .gsub(/([a-z\d])([A-Z])/, '\1_\2')
      .tr(' ', '_')
      .downcase
end

#to_sObject



19
20
21
# File 'lib/sipp.rb', line 19

def to_s
  t klass_name, @sym
end

#to_symObject



31
32
33
# File 'lib/sipp.rb', line 31

def to_sym
  @sym
end