On Tue, May 12, 2020 at 7:36 PM Craig Russell <apache....@gmail.com> wrote:
>
> https://github.com/apache/whimsy/pull/93
>
> I'm starting this project with a simple(r) task: allowing the roster 
> committer page to display any files related to the member's emeritus status: 
> files in documents/emeritus and documents/emeritus-requests-received.
>
> I added a find method to the EmeritusRequestFiles and EmeritusFiles classes. 
> There should be a way to *not* copy and paste the details of these methods, 
> like a generic or static method.

Looks like a job for inheritance.  Example:

class Base
  def self.find(name)
    self.value[name]
  end
end

class First < Base
  def self.value
    {text: 'first class'}
  end
end

class Second < Base
  def self.value
    {text: 'second class'}
  end
end

puts First.find(:text)
puts Second.find(:text)

> Suggestions/comments are appreciated.
>
> Thanks,
> Craig

- Sam Ruby

> > On May 6, 2020, at 1:01 PM, Sam Ruby <ru...@intertwingly.net> wrote:
> >
> > On Wed, May 6, 2020 at 3:48 PM Craig Russell <apache....@gmail.com> wrote:
> >>
> >> I've been looking for where the roster post actions are handled. I have 
> >> the model for committer and the html in the browser.
> >>
> >> But where are post action:emeritus and action:active handled?
> >
> > All of the routes are defined here:
> >
> > https://github.com/apache/whimsy/blob/master/www/roster/main.rb
> >
> > Unless you have unusual needs, you can take advantage of the generic
> > route defined here:
> >
> > https://github.com/apache/whimsy/blob/1316a898d5e8c91e8a33d89565d12efc4842dd56/www/roster/main.rb#L343
> >
> > If you use that route, then /actions/emeritus will invoke a script by
> > that name in the whimsy/www/roster/views/actions directory, and will
> > take value returned by the last line, convert it to JSON and sent the
> > results back to the client.
> >
> >> Thanks,
> >> Craig
> >
> > - Sam Ruby
> >
> >> Craig L Russell
> >> c...@apache.org
> >>
>
> Craig L Russell
> c...@apache.org
>

Reply via email to