Class: Lite::Command::Context
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Lite::Command::Context
- Defined in:
- lib/lite/command/context.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build(attributes = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lite/command/context.rb', line 9 def self.build(attributes = {}) return attributes if attributes.is_a?(self) && !attributes.frozen? # To save memory and speed up the access to an attribute, the accessor methods # of an attribute are lazy loaded at certain points. This means that the methods # are defined only when a set of defined actions are triggered. This allows context # to only define the minimum amount of required methods to make your data structure work os = new(attributes.to_h) os.methods(false) os end |
Instance Method Details
#merge!(attributes = {}) ⇒ Object
21 22 23 |
# File 'lib/lite/command/context.rb', line 21 def merge!(attributes = {}) attributes.to_h.each { |k, v| self[k] = v } end |