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.



19
20
21
22
23
# File 'lib/reflex/style.rb', line 19

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



47
48
49
# File 'lib/reflex/style.rb', line 47

def background ()
  return background_fill, background_stroke
end

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



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

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

#flowObject



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

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

#flow=(*syms) ⇒ Object



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

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

#foregroundObject



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

def foreground ()
  return foreground_fill, foreground_stroke
end

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



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

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

#inspectObject



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/reflex/style.rb', line 98

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