Module: SurveyMetamodel::Style::ClassModule

Defined in:
lib/generators/survey/metamodels/style.rb

Instance Method Summary collapse

Instance Method Details

#background?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/generators/survey/metamodels/style.rb', line 62

def background?
  !background.nil?
end

#color(color) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/generators/survey/metamodels/style.rb', line 87

def color(color)
  if color == :blue
    "#0000FF"
  elsif color == :red
    "#FF0000"
  elsif color == :yellow
    "#FFFF00"
  elsif color == :gray
    "#808080"
  elsif color == :green
    "#008000"
  elsif color == :white
    "#FFFFFF"
  elsif color == :black
    "#000000"
  elsif color == :lightGray
    "#D3D3D3"
  elsif color == :darkGray
    "#A9A9A9"
  else
    "#FFFFFF"
  end
end

#font_size?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/generators/survey/metamodels/style.rb', line 66

def font_size?
  !font_size.nil? and margin != 0
end

#font_style?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/generators/survey/metamodels/style.rb', line 70

def font_style?
  !font_style.nil?
end

#font_weight?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/generators/survey/metamodels/style.rb', line 74

def font_weight?
  !font_weight.nil?
end

#foreground?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/generators/survey/metamodels/style.rb', line 58

def foreground?
  !foreground.nil?
end

#horizontal_alignObject



129
130
131
132
133
134
135
136
137
# File 'lib/generators/survey/metamodels/style.rb', line 129

def horizontal_align
  if horizontal_alignment == :left
    "left"
  elsif horizontal_alignment == :center
    "center"
  elsif horizontal_alignment == :right
    "right"
  end
end

#horizontal_align?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/generators/survey/metamodels/style.rb', line 78

def horizontal_align?
  !horizontal_align.nil?
end

#margin?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/generators/survey/metamodels/style.rb', line 50

def margin?
  !margin.nil? and margin != 0
end

#padding?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/generators/survey/metamodels/style.rb', line 54

def padding?
  !padding.nil? and margin != 0
end

#styleObject



111
112
113
114
115
116
117
118
119
# File 'lib/generators/survey/metamodels/style.rb', line 111

def style
  if font_style == :normal
    "normal"
  elsif font_style == :italic
    "italic"
  elsif font_style == :oblique
    "oblique"
  end
end

#vertical_alignObject



139
140
141
142
143
144
145
146
147
# File 'lib/generators/survey/metamodels/style.rb', line 139

def vertical_align
  if vertical_alignment == :top
    "top"
  elsif vertical_alignment == :middle
    "middle"
  elsif vertical_alignment == :bottom
    "bottom"
  end
end

#vertical_align?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/generators/survey/metamodels/style.rb', line 82

def vertical_align?
  !vertical_align.nil?
end

#weightObject



121
122
123
124
125
126
127
# File 'lib/generators/survey/metamodels/style.rb', line 121

def weight
  if font_weight == :normal
    "normal"
  elsif font_weight == :bold
    "italic"
  end
end