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

Class-based implemetation #26

Closed
hidakatsuya opened this issue Jun 1, 2015 · 1 comment
Closed

Class-based implemetation #26

hidakatsuya opened this issue Jun 1, 2015 · 1 comment
Assignees

Comments

@hidakatsuya
Copy link
Member

Concept A:

class EstimateReport < Thinreports::Report::Base
  use_layout 'estimate.tlf', default: true

  def add(estimate)
    start_new_page do |page|
      page[:customer_name] = estimate.customer.name
      # :
    end
  end
end

estimate = Estimate.find(params[:id])

report = EstimateReport.new
report.add(estimate)

report.generate # => PDF data

Concept B:

class EstimateReport < Thinreports::Report::Base
  use_layout 'estimate.tlf', default: true

  def self.generate(estimate)
    report = self.new
    report.add estimate
    report.generate
  end

  def add(estimate)
    start_new_page do |page|
      # :
    end
  end
end

estimate = Estimate.find(params[:id])
EstimateReport.generate(estimate) # => PDF data
@hidakatsuya hidakatsuya added the enhancement New feature or request label Jun 1, 2015
@hidakatsuya hidakatsuya self-assigned this Jun 1, 2015
@hidakatsuya hidakatsuya added this to the 0.8.1 milestone Jun 1, 2015
@hidakatsuya hidakatsuya modified the milestones: 1.0.0, 0.8.1 Jun 24, 2015
@hidakatsuya hidakatsuya added Concept and removed enhancement New feature or request labels Oct 31, 2015
@hidakatsuya hidakatsuya modified the milestone: 1.0.0 Nov 6, 2015
@hidakatsuya
Copy link
Member Author

やりたい気持ちはあるが、他にやるべきことがたくさんあるので一旦 close します。

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