Class: Sunnytrail::Event

Inherits:
Hashie::Dash
  • Object
show all
Defined in:
lib/sunnytrail.rb

Defined Under Namespace

Classes: Action, Plan

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject



115
116
117
# File 'lib/sunnytrail.rb', line 115

def action
  @action ||= Action.new
end

#planObject



119
120
121
# File 'lib/sunnytrail.rb', line 119

def plan
  @plan ||= Plan.new
end

Instance Method Details

#to_hashObject



123
124
125
126
127
128
129
130
131
# File 'lib/sunnytrail.rb', line 123

def to_hash
  out = {}
  out["action"] = @action.nil? ? {} : @action.to_hash
  out["plan"] = @plan.nil? ? {} : @plan.to_hash
  keys.each do |k|
    out[k] = Hashie::Hash === self[k] ? self[k].to_hash : self[k]
  end
  out
end

#to_jsonObject



133
134
135
# File 'lib/sunnytrail.rb', line 133

def to_json
  to_hash.to_json
end