Class: Reflex::Style

Inherits:
Object
  • Object
show all
Includes:
HasTags, Xot::Setter
Defined in:
lib/reflex/style.rb

Instance Method Summary collapse

Methods included from HasTags

#clear_tags, #tag, #tag=, #tags, #untag

Constructor Details

#initialize(options = nil, &block) ⇒ Style

Returns a new instance of Style.



16
17
18
19
20
# File 'lib/reflex/style.rb', line 16

def initialize(options = nil, &block)
  super()
  set options if options
  Xot::BlockUtil.instance_eval_or_block_call self, &block if block
end

Instance Method Details

#backgroundObject



44
45
46
# File 'lib/reflex/style.rb', line 44

def background()
  return background_fill, background_stroke
end

#background=(fill, stroke = nil) ⇒ Object



39
40
41
42
# File 'lib/reflex/style.rb', line 39

def background=(fill, stroke = nil)
  self.background_fill   = fill
  self.background_stroke = stroke
end

#flowObject



26
27
28
# File 'lib/reflex/style.rb', line 26

def flow()
  get_flow.map {|n| flow2sym n}
end

#flow=(*syms) ⇒ Object



22
23
24
# File 'lib/reflex/style.rb', line 22

def flow=(*syms)
  set_flow(*syms.flatten.map {|sym| sym2flow sym})
end

#foregroundObject



35
36
37
# File 'lib/reflex/style.rb', line 35

def foreground()
  return foreground_fill, foreground_stroke
end

#foreground=(fill, stroke = nil) ⇒ Object



30
31
32
33
# File 'lib/reflex/style.rb', line 30

def foreground=(fill, stroke = nil)
  self.foreground_fill   = fill
  self.foreground_stroke = stroke
end

#inspectObject



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/reflex/style.rb', line 95

def inspect()
  attrs = {
    selector:   selector,
    flow:       flow,
    size:       size,
    position:   position,
    margin:     margin,
    padding:    padding,
    center:     center,
    foreground: foreground,
    background: background,
    image:      image
  }
  "#<Reflex::Style #{attrs.map {|k, v| %(#{k}:#{v.to_s})}.join ' '}>"
end