Class: Expo3
- Inherits:
-
Object
- Object
- Expo3
- Defined in:
- lib/expo3.rb
Defined Under Namespace
Classes: Builder
Instance Method Summary collapse
- #expects?(keyparam) ⇒ Boolean
- #expo(obj = nil, **context) ⇒ Object
- #expo_collection(coll) ⇒ Object
- #fix(**context) ⇒ Object
-
#initialize(**context, &block) ⇒ Expo3
constructor
A new instance of Expo3.
- #upgrade(&block) ⇒ Object
Constructor Details
#initialize(**context, &block) ⇒ Expo3
Returns a new instance of Expo3.
89 90 91 92 |
# File 'lib/expo3.rb', line 89 def initialize(**context, &block) @block = block @context = context end |
Instance Method Details
#expects?(keyparam) ⇒ Boolean
94 95 96 |
# File 'lib/expo3.rb', line 94 def expects?(keyparam) @block.parameters.detect{|k,param| param == keyparam } end |
#expo(obj = nil, **context) ⇒ Object
112 113 114 115 116 |
# File 'lib/expo3.rb', line 112 def expo(obj=nil, **context) builder = Builder.new(self) builder.instance_exec(obj, **(@context.merge(context)), &@block) if @block builder.output(obj, **context) end |
#expo_collection(coll) ⇒ Object
118 119 120 |
# File 'lib/expo3.rb', line 118 def expo_collection(coll) coll.map(&method(:expo)) end |