Class: Glib::Json::DynamicText::TextSpec

Inherits:
Struct
  • Object
show all
Defined in:
app/controllers/concerns/glib/json/dynamic_text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



54
55
56
# File 'app/controllers/concerns/glib/json/dynamic_text.rb', line 54

def args
  @args
end

#propObject

Returns the value of attribute prop

Returns:

  • (Object)

    the current value of prop



54
55
56
# File 'app/controllers/concerns/glib/json/dynamic_text.rb', line 54

def prop
  @prop
end

#viewObject

Returns the value of attribute view

Returns:

  • (Object)

    the current value of view



54
55
56
# File 'app/controllers/concerns/glib/json/dynamic_text.rb', line 54

def view
  @view
end

Instance Method Details

#substitute_with(text) ⇒ Object



55
56
57
# File 'app/controllers/concerns/glib/json/dynamic_text.rb', line 55

def substitute_with(text)
  view[prop] = text.gsub(/\{\{(\w+)\}\}/) { args.fetch($1, "{{#{$1}}}") }
end