Class: Purview::Structs::Base
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Purview::Structs::Base
show all
- Defined in:
- lib/purview/structs/base.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
14
15
16
17
18
|
# File 'lib/purview/structs/base.rb', line 14
def method_missing(method, *args, &block)
method = method.to_sym unless method.is_a?(Symbol)
raise NoMethodError if args.empty? && !respond_to?(method)
super
end
|
Instance Method Details
4
5
6
7
8
|
# File 'lib/purview/structs/base.rb', line 4
def [](key)
key = key.to_sym unless key.is_a?(Symbol)
raise NoMethodError unless respond_to?(key)
send(key)
end
|
#[]=(key, value) ⇒ Object
10
11
12
|
# File 'lib/purview/structs/base.rb', line 10
def []=(key, value)
send("#{key}=", value)
end
|