Class: Acronym
- Inherits:
-
Object
- Object
- Acronym
- Defined in:
- lib/acronym.rb
Overview
file: acronym.rb
Instance Attribute Summary collapse
-
#to_a ⇒ Object
readonly
Returns the value of attribute to_a.
Instance Method Summary collapse
-
#initialize(a = []) ⇒ Acronym
constructor
A new instance of Acronym.
Constructor Details
#initialize(a = []) ⇒ Acronym
Returns a new instance of Acronym.
9 10 11 12 13 14 15 |
# File 'lib/acronym.rb', line 9 def initialize(a=[]) @to_a = a.inject([]) do |r,s| acronym_id = acronym(s) acronym_id.succ! while r.include? acronym_id r << acronym_id end end |
Instance Attribute Details
#to_a ⇒ Object (readonly)
Returns the value of attribute to_a.
7 8 9 |
# File 'lib/acronym.rb', line 7 def to_a @to_a end |