class Whereby::Element
Public Class Methods
new(attrs = {})
click to toggle source
# File lib/whereby/element.rb, line 3 def initialize(attrs = {}) # Only set attributes if the method exists attrs.each{ |k,v| send("#{k.whereby_underscore}=", v) if respond_to?(k.whereby_underscore.to_s) } end
Public Instance Methods
to_h()
click to toggle source
# File lib/whereby/element.rb, line 8 def to_h Hash[ *instance_variables.map do |variable| name = variable[1..-1].to_sym #Removing @ [name, instance_variable_get(variable)] end.flatten ] end