Class: Surrounded::Context::RoleName

Inherits:
Object
  • Object
show all
Defined in:
lib/surrounded/context.rb

Instance Method Summary collapse

Constructor Details

#initialize(string, suffix = nil) ⇒ RoleName

Returns a new instance of RoleName.



298
299
300
301
302
303
304
305
306
307
# File 'lib/surrounded/context.rb', line 298

def initialize(string, suffix=nil)
  @string = string.
              to_s.
              split(/_/).
              map{|part|
                part.capitalize
              }.
              join.
              sub(/_\d+/,'') + suffix.to_s
end

Instance Method Details

#to_strObject Also known as: to_s



309
310
311
# File 'lib/surrounded/context.rb', line 309

def to_str
  @string
end

#to_symObject



314
315
316
# File 'lib/surrounded/context.rb', line 314

def to_sym
  @string.to_sym
end