Class: Squib::DSL::Text
- Inherits:
-
Object
- Object
- Squib::DSL::Text
- Includes:
- WarnUnexpectedParams
- Defined in:
- lib/squib/dsl/text.rb
Instance Attribute Summary collapse
- #deck ⇒ Object readonly
- #dsl_method ⇒ Object readonly
- #embed ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(deck, dsl_method, embed) ⇒ Text
constructor
A new instance of Text.
- #run(opts) ⇒ Object
Methods included from WarnUnexpectedParams
Constructor Details
#initialize(deck, dsl_method, embed) ⇒ Text
Returns a new instance of Text.
23 24 25 26 27 |
# File 'lib/squib/dsl/text.rb', line 23 def initialize(deck, dsl_method, ) @deck = deck @dsl_method = dsl_method = end |
Instance Attribute Details
#deck ⇒ Object (readonly)
21 22 23 |
# File 'lib/squib/dsl/text.rb', line 21 def deck @deck end |
#dsl_method ⇒ Object (readonly)
21 22 23 |
# File 'lib/squib/dsl/text.rb', line 21 def dsl_method @dsl_method end |
#embed ⇒ Object (readonly)
21 22 23 |
# File 'lib/squib/dsl/text.rb', line 21 def end |
Class Method Details
.accepted_params ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/squib/dsl/text.rb', line 29 def self.accepted_params i( str font font_size x y markup width height wrap spacing align justify valign ellipsize angle dash cap join hint color fill_color stroke_color stroke_width stroke_width stroke_color stroke_strategy range layout ) end |
Instance Method Details
#run(opts) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/squib/dsl/text.rb', line 39 def run(opts) warn_if_unexpected opts range = Args.extract_range opts, deck para = Args.extract_para opts, deck box = Args.extract_box opts, deck, { width: :auto, height: :auto } trans = Args.extract_transform opts, deck draw = Args.extract_draw opts, deck, { stroke_width: 0.0 } extents = Array.new(deck.size) range.each do |i| extents[i] = deck.cards[i].text(, para[i], box[i], trans[i], draw[i], deck.dpi) end return extents end |