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[: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
def verbose_merge(to, from)

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

Loading…
Cancel
Save