Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby dsl #6

Open
jmikedupont2 opened this issue Jun 22, 2024 · 0 comments
Open

ruby dsl #6

jmikedupont2 opened this issue Jun 22, 2024 · 0 comments

Comments

@jmikedupont2
Copy link
Member

class HerosJourney < ApplicationRecord
belongs_to :hero
belongs_to :world
has_many :events
has_many :challenges
has_one :mentor
has_one :sword
has_one :home

state_machine :state, initial: :ordinary_world do
event :handle_event do
transition any => same
end

event :receive_call do
  transition ordinary_world: :adventure
end

event :begin_journey do
  transition adventure: :crossing_threshold
end

event :thrown_into_world do
  transition crossing_threshold: :tests_allies_enemies
end

event :join_team do
  transition tests_allies_enemies: :approach
end

event :meet_mentor do
  transition any => same
end

event :cross_threshold do
  transition tests_allies_enemies: :approach
end

event :observe do
  transition any => same
end

event :descend do
  transition approach: :ordeal
end

event :raise_to_apotheosis do
  transition ordeal: :reward
end

event :decide do
  transition any => same
end

event :act do
  transition any => same
end

event :judge do
  transition any => same
end

event :critique do
  transition any => same
end

event :struggle do
  transition any => same
end

event :transform do
  transition ordeal: :reward
end

event :take_sword do
  transition reward: :road_back
end

event :gain_wisdom do
  transition any => same
end

event :refuse_call do
  transition adventure: :ordinary_world
end

event :succeed do
  transition road_back: :resurrection
end

event :return_home do
  transition resurrection: :return_with_elixir
end

event :resurrect do
  transition any => :resurrection
end

end

def recognize(recognition)
# Implementation
end

def observe(observation)
# Implementation
end

Other methods...

end

class Hero < ApplicationRecord
has_one :heros_journey
has_many :challenges
has_one :sword
has_one :home

def struggle(challenge)
# Implementation
end

def transform(challenge)
# Implementation
end

def take(sword)
# Implementation
end

def gain(wisdom)
# Implementation
end

def refusal(call)
# Implementation
end

def succeed(sword)
# Implementation
end

def return_to(home)
# Implementation
end

def resurrection(failure)
# Implementation
end
end

Other necessary models...

class World < ApplicationRecord; end
class Event < ApplicationRecord; end
class Challenge < ApplicationRecord; end
class Mentor < ApplicationRecord; end
class Sword < ApplicationRecord; end
class Home < ApplicationRecord; end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant