Module: MotionMastr

Defined in:
lib/motion-mastr/mastr.rb,
lib/motion-mastr/version.rb,
lib/motion-mastr/mastr_builder.rb,
lib/motion-mastr/attributes/font_attribute.rb,
lib/motion-mastr/attributes/kern_attribute.rb,
lib/motion-mastr/attributes/link_attribute.rb,
lib/motion-mastr/attributes/shadow_attribute.rb,
lib/motion-mastr/attributes/ligature_attribute.rb,
lib/motion-mastr/attributes/expansion_attribute.rb,
lib/motion-mastr/attributes/attachment_attribute.rb,
lib/motion-mastr/attributes/obliqueness_attribute.rb,
lib/motion-mastr/attributes/text_effect_attribute.rb,
lib/motion-mastr/attributes/stroke_color_attribute.rb,
lib/motion-mastr/attributes/stroke_width_attribute.rb,
lib/motion-mastr/attributes/underline_style_helper.rb,
lib/motion-mastr/attributes/baseline_offset_attribute.rb,
lib/motion-mastr/attributes/paragraph_style_attribute.rb,
lib/motion-mastr/attributes/underline_color_attribute.rb,
lib/motion-mastr/attributes/underline_style_attribute.rb,
lib/motion-mastr/attributes/background_color_attribute.rb,
lib/motion-mastr/attributes/foreground_color_attribute.rb,
lib/motion-mastr/attributes/strikethrough_color_attribute.rb,
lib/motion-mastr/attributes/strikethrough_style_attribute.rb

Defined Under Namespace

Modules: Attributes Classes: MastrBuilder

Constant Summary collapse

VERSION =
"0.3.0"

Instance Method Summary collapse

Instance Method Details

#mastr(text = nil, default_styles = nil) ⇒ Object

make a MastrBuilder



4
5
6
7
8
9
10
11
12
# File 'lib/motion-mastr/mastr.rb', line 4

def mastr(text=nil, default_styles=nil)
  styles = {}
  styles.merge!(text) if text.is_a?(Hash)
  styles.merge!(default_styles) if default_styles.is_a? Hash

  b = MastrBuilder.new styles
  b.add(text) unless text.nil? || text.is_a?(Hash)
  b
end

#mastr!(text = nil, default_styles = nil) ⇒ Object

make and build a NSMutableAttributedString



15
16
17
# File 'lib/motion-mastr/mastr.rb', line 15

def mastr!(text=nil, default_styles=nil)
  mastr(text, default_styles).build
end