
s2k
Author of Fast Feedback Using Ruby
An ERB/bundler behaviour I don't understand
I have this code in a file that’s used to … render templates.
require 'erb'
require 'ostruct'
MISSING_CONFIG_MARKER = :config_key_and_value_missing
def render(template, configuration_data)
config_object = OpenStruct.new(configuration_data)
config_object.table.default = MISSING_CONFIG_MARKER
ERB.new(template).result(config_object.instance_eval { binding })
end
I also have some tests for this, that show a behaviour I don’t understand:
When running the tests in the context of Bundler, one these fails (one that expects to find the MISSING_CONFIG_MARKER
. However, when not running in bundler context, all tests pass.
I’d like to understand why that is, and ideally learn what I need to do to have the set default being used in the context of Bundler as well.
To illustrate all this I’ve set up a repository with a minimal (I think) project, showing the behaviour. See https://github.com/s2k/erb-templating
Popular Backend topics

Real-time applications come with real challenges—persistent connections, multi-server deployment, and strict performance requirements are...
New

Currently a hot topic in the BEAM world, let’s start a thread for it (as suggested by @crowdhailer here) :smiley:
What are your current...
New

New

How Dgraph was running out of memory for some users, and how Go’s Garbage collector wasn’t enough, and Dgraph team used jemalloc to manag...
New

If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New

Can Phoenix LiveView be used in multi-page applications, unlike React/Vue/Blazor which seems to be targeted for SPA?
New

Hello Folks,
I am a novice developer from India. Intending to learn Elixir and web apps (phoenix framework).
What are things that I MUS...
New

Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New

Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New

Develop, deploy, and debug BEAM applications using BEAMOps: a new paradigm that focuses on scalability, fault tolerance, and owning each ...
New
Other popular topics

Let’s get real. As in really knowing—clearly and practically—what’s up with Phoenix LiveView.
What is it?
How does it work?
What can I ...
New

Any thoughts on Svelte?
Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New

SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New

Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face:
Perhaps if there’s enough peop...
New

I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New

Here’s our thread for the Keyboardio Atreus. It is a mechanical keyboard based on and a slight update of the original Atreus (Keyboardio ...
New

Do the test and post your score :nerd_face:
:keyboard:
If possible, please add info such as the keyboard you’re using, the layout (Qw...
New

Woooooooo! This is such a huge release for it, and 2 years incoming!
In short, the library is now using an updated hyper backend (not j...
New
New

Author Spotlight:
David Bryant Copeland
@davetron5000
We’re so happy to bring you another Author Spotlight, a series where we sit dow...
New
Latest in Backend
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /react-native
- /v
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /swift
- /js
- /deno
- /tailwind
- /assemblyscript
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /c-plus-plus
- /preact
- /flutter
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /keyboards
- /html
- /emacs
- /nim
- /vuejs
- /nerves
- /elm