Module: Thinreports::BasicReport::Utils
- Included in:
- Thinreports::BasicReport, Core::Shape::Base::Interface, Core::Shape::Base::Internal, Core::Shape::Basic::Format, Core::Shape::List::Manager, Core::Shape::Manager::Internal, Core::Shape::Manager::Target, Core::Shape::Style::Base, Core::Shape::TextBlock::Formatter, Core::Shape::TextBlock::Formatter::Basic, Generator::PDF::Document, Layout::Base, Layout::LegacySchema, Report::Base
- Defined in:
- lib/thinreports/basic_report/core/utils.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
6 7 8 |
# File 'lib/thinreports/basic_report/core/utils.rb', line 6 def self.included(klass) klass.extend self end |
Instance Method Details
#blank_value?(value) ⇒ Boolean
25 26 27 28 29 30 31 |
# File 'lib/thinreports/basic_report/core/utils.rb', line 25 def blank_value?(value) case value when String then value.empty? when NilClass then true else false end end |
#call_block_in(scope, &block) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/thinreports/basic_report/core/utils.rb', line 33 def call_block_in(scope, &block) return scope unless block_given? if block.arity == 1 block.call(scope) else scope.instance_eval(&block) end scope end |
#deep_copy(src) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/thinreports/basic_report/core/utils.rb', line 10 def deep_copy(src) case src when Hash src.each_with_object({}) do |(k, v), h| h[k] = v.dup rescue v end when Array src.map do |a| a.dup rescue a end else raise ArgumentError end end |