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(opts = {}, &block) ⇒ Style

Returns a new instance of Style.



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

def initialize (opts = {}, &block)
  super()
  set opts
  Xot::BlockUtil.instance_eval_or_block_call self, &block if block
end

Instance Method Details

#flowObject



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

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

#flow=(*syms) ⇒ Object



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

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

#inspectObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/reflex/style.rb', line 32

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