Class: Easyrb::Context
- Inherits:
-
Object
- Object
- Easyrb::Context
- Defined in:
- lib/easyrb/context.rb
Instance Attribute Summary collapse
-
#helpers ⇒ Object
readonly
# Declarations # #.
Class Method Summary collapse
-
.[](context, helpers) ⇒ Object
# Class Methods # #.
Instance Method Summary collapse
-
#generate_context ⇒ Object
# Instance Methods # #.
-
#initialize(context, helpers) ⇒ Context
constructor
# Constructor # #.
Constructor Details
#initialize(context, helpers) ⇒ Context
# Constructor #
#
19 20 21 22 |
# File 'lib/easyrb/context.rb', line 19 def initialize(context, helpers) @context = context @helpers = Array(helpers) end |
Instance Attribute Details
#helpers ⇒ Object (readonly)
# Declarations #
#
11 12 13 |
# File 'lib/easyrb/context.rb', line 11 def helpers @helpers end |
Class Method Details
.[](context, helpers) ⇒ Object
# Class Methods #
#
30 31 32 |
# File 'lib/easyrb/context.rb', line 30 def self.[](context, helpers) new(context, helpers).generate_context end |
Instance Method Details
#generate_context ⇒ Object
# Instance Methods #
#
40 41 42 43 44 45 46 |
# File 'lib/easyrb/context.rb', line 40 def generate_context context.tap do |obj| helpers.each do |mod| obj.extend(mod) end end end |