Class: MarkdownExpander::Expander::Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/markdown_expander/expander.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Expression

Returns a new instance of Expression.



79
80
81
# File 'lib/markdown_expander/expander.rb', line 79

def initialize value
  @value = value
end

Instance Method Details

#evaluate(scope) ⇒ Object



82
83
84
85
86
87
88
89
# File 'lib/markdown_expander/expander.rb', line 82

def evaluate scope
  parts = @value.split(".")
  current_scope = scope
  parts.each do |part|
    current_scope = current_scope[part.to_sym]
  end
  current_scope
end