Class: Surrounded::Context::RoleName
- Inherits:
-
Object
- Object
- Surrounded::Context::RoleName
- Defined in:
- lib/surrounded/context.rb
Instance Method Summary collapse
-
#initialize(string, suffix = nil) ⇒ RoleName
constructor
A new instance of RoleName.
- #to_str ⇒ Object (also: #to_s)
- #to_sym ⇒ Object
Constructor Details
#initialize(string, suffix = nil) ⇒ RoleName
Returns a new instance of RoleName.
290 291 292 293 294 295 296 297 298 299 |
# File 'lib/surrounded/context.rb', line 290 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_str ⇒ Object Also known as: to_s
301 302 303 |
# File 'lib/surrounded/context.rb', line 301 def to_str @string end |
#to_sym ⇒ Object
306 307 308 |
# File 'lib/surrounded/context.rb', line 306 def to_sym @string.to_sym end |