Class: Teamocil::ClosedStruct
- Inherits:
-
Struct
- Object
- Struct
- Teamocil::ClosedStruct
- Defined in:
- lib/teamocil/utils/closed_struct.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ ClosedStruct
constructor
A new instance of ClosedStruct.
Constructor Details
#initialize(*args) ⇒ ClosedStruct
Returns a new instance of ClosedStruct.
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/teamocil/utils/closed_struct.rb', line 3 def initialize(*args) args = [{}] unless args.any? args.first.each_pair do |key, value| # Make sure we only set values to defined arguments if members.map(&:intern).include?(key.to_sym) send "#{key}=", value else raise ArgumentError, "#{self.class.name} doesn’t support the `#{key}` keyword, only #{members.join(', ')}" end end end |