Class: NewPage::InputableContext
- Inherits:
-
Liquid::Context
- Object
- Liquid::Context
- NewPage::InputableContext
- Defined in:
- lib/new_page/input_hash.rb
Instance Method Summary collapse
- #do_not_input(*keys) ⇒ Object
- #hash_create_args ⇒ Object
-
#initialize(enviroments: {}, outer_scope: {}, registers: {}, rethrow_errors: true, resource_limits: nil, **args) ⇒ InputableContext
constructor
A new instance of InputableContext.
- #new_hash(source) ⇒ Object
- #push(new_scope) ⇒ Object
Constructor Details
#initialize(enviroments: {}, outer_scope: {}, registers: {}, rethrow_errors: true, resource_limits: nil, **args) ⇒ InputableContext
Returns a new instance of InputableContext.
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/new_page/input_hash.rb', line 154 def initialize(enviroments: {}, outer_scope: {}, registers: {}, rethrow_errors: true, resource_limits: nil, **args) print "InputableContext #{args}\n" @context_args= args environments = [environments].flatten.map { |env| new_hash(env) } outer_scope = new_hash(outer_scope) unless outer_scope.is_a? InputHash super(environments, outer_scope, registers, rethrow_errors, resource_limits) @filled_keys = [] Readline.completion_append_character = " " Readline.completer_word_break_characters = " \t" end |
Instance Method Details
#do_not_input(*keys) ⇒ Object
177 178 179 180 181 |
# File 'lib/new_page/input_hash.rb', line 177 def do_not_input(*keys) keys.map { |key| key.to_sym }.each do |key| @filled_keys << key unless @data.has_key? key end end |
#hash_create_args ⇒ Object
168 169 170 |
# File 'lib/new_page/input_hash.rb', line 168 def hash_create_args @context_args end |
#new_hash(source) ⇒ Object
172 173 174 175 |
# File 'lib/new_page/input_hash.rb', line 172 def new_hash(source) source = {} if source.nil? return InputHash.new(source, **@context_args) end |
#push(new_scope) ⇒ Object
183 184 185 186 |
# File 'lib/new_page/input_hash.rb', line 183 def push(new_scope) new_scope = new_hash(new_scope) unless new_scope.is_a? InputHash super(new_hash(new_scope)) end |