Class: European::NamedCarryAllItem
- Inherits:
-
Object
- Object
- European::NamedCarryAllItem
- Defined in:
- lib/european/named_carry_all_item.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#proc ⇒ Object
readonly
Returns the value of attribute proc.
Instance Method Summary collapse
- #exec(proc) ⇒ Object
-
#initialize(args) ⇒ NamedCarryAllItem
constructor
A new instance of NamedCarryAllItem.
- #setup ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(args) ⇒ NamedCarryAllItem
Returns a new instance of NamedCarryAllItem.
7 8 9 10 |
# File 'lib/european/named_carry_all_item.rb', line 7 def initialize(args) @name = args[:name] || raise(':name is required') @proc = args[:proc] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/european/named_carry_all_item.rb', line 5 def name @name end |
#proc ⇒ Object (readonly)
Returns the value of attribute proc.
5 6 7 |
# File 'lib/european/named_carry_all_item.rb', line 5 def proc @proc end |
Instance Method Details
#exec(proc) ⇒ Object
16 17 18 |
# File 'lib/european/named_carry_all_item.rb', line 16 def exec(proc) instance_eval &proc end |
#setup ⇒ Object
12 13 14 |
# File 'lib/european/named_carry_all_item.rb', line 12 def setup instance_eval &@proc if @proc end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/european/named_carry_all_item.rb', line 20 def to_s "#{self.class} '#{name}'" end |