Class: TellThem::TellThemStore
- Inherits:
-
Object
- Object
- TellThem::TellThemStore
- Includes:
- Singleton
- Defined in:
- lib/tell-them/tell-them.rb
Instance Method Summary collapse
- #add(data) ⇒ Object
- #data ⇒ Object
- #enable_media_queries(data) ⇒ Object
- #has_data? ⇒ Boolean
- #has_media_grid_info? ⇒ Boolean
- #has_media_queries? ⇒ Boolean
-
#initialize ⇒ TellThemStore
constructor
A new instance of TellThemStore.
- #media_grid_max_columns ⇒ Object
- #media_queries ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ TellThemStore
Returns a new instance of TellThemStore.
167 168 169 |
# File 'lib/tell-them/tell-them.rb', line 167 def initialize reset end |
Instance Method Details
#add(data) ⇒ Object
176 177 178 |
# File 'lib/tell-them/tell-them.rb', line 176 def add(data) data.each { |k,v| @data_store[k] = v } end |
#data ⇒ Object
188 189 190 |
# File 'lib/tell-them/tell-them.rb', line 188 def data @data_store end |
#enable_media_queries(data) ⇒ Object
180 181 182 |
# File 'lib/tell-them/tell-them.rb', line 180 def enable_media_queries(data) @media_queries = data end |
#has_data? ⇒ Boolean
184 185 186 |
# File 'lib/tell-them/tell-them.rb', line 184 def has_data? @data_store.any? end |
#has_media_grid_info? ⇒ Boolean
196 197 198 199 200 201 202 203 204 |
# File 'lib/tell-them/tell-them.rb', line 196 def has_media_grid_info? return false unless has_media_queries? @media_queries.each do |mq| next unless mq.has_key?(:columns) return true if mq[:columns] == 1 && mq.has_key?(:margins) return true if mq[:columns] > 1 && mq.has_key?(:column_width) && mq.has_key?(:column_space) end false end |
#has_media_queries? ⇒ Boolean
192 193 194 |
# File 'lib/tell-them/tell-them.rb', line 192 def has_media_queries? @media_queries.any? end |
#media_grid_max_columns ⇒ Object
210 211 212 213 214 |
# File 'lib/tell-them/tell-them.rb', line 210 def media_grid_max_columns columns = 0 media_queries.each { |mq| columns = [columns, mq[:columns]].max } columns end |
#media_queries ⇒ Object
206 207 208 |
# File 'lib/tell-them/tell-them.rb', line 206 def media_queries @media_queries end |
#reset ⇒ Object
171 172 173 174 |
# File 'lib/tell-them/tell-them.rb', line 171 def reset @data_store = {} @media_queries = [] end |