Stub expanded stock class

pull/8/head
Daniel Asher Resnick 2 years ago
parent 43cca46dde
commit 3f5b2f4219
  1. 2
      src/lib/data.rb
  2. 48
      src/lib/stock.rb

@ -30,7 +30,7 @@ module Charred
@data[:traits] = @data[:traits].sort.to_h @data[:traits] = @data[:traits].sort.to_h
@data[:skills] = @data[:skills].sort.to_h @data[:skills] = @data[:skills].sort.to_h
@data[:stock_objs] = @data[:stocks].map { |s| Stock.new s, s } @data[:stock_objs] = @data[:stocks].map { |s| Stock.new s }
end end
def verbose_merge(to, from) def verbose_merge(to, from)

@ -1,22 +1,34 @@
module Charred module Charred
# module Stock class Stock
class Stock @@default_stride = 6
attr :key
attr :name
def initialize(key, name) attr :key
@key = key attr :name
@name = name attr :stride
end attr :common_traits
def as_json(options = {}) attr :settings
{ attr :starting_stats
"key" => key,
"name" => name def initialize(key, name = key, stride = @@default_stride)
} @key = key
end @name = name
def to_json(*a) @stride = stride
as_json.to_json(*a) @common_traits = []
end @settings = []
# end @starting_stats = []
end
def as_json(options = {})
{
"key" => key,
"name" => name,
"stride" => stride,
"common_traits" => common_traits,
"settings" => settings,
"starting_stats" => starting_stats
}
end
def to_json(*a)
as_json.to_json(*a)
end
end end
end end

Loading…
Cancel
Save